MCPcopy Create free account
hub / github.com/PeterFWS/Structure-PLP-SLAM / image_sequence

Method image_sequence

example/util/image_planeSeg_util.cc:32–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#include <iostream>
31
32image_sequence::image_sequence(const std::string &img_dir_path, const double fps)
33 : fps_(fps)
34{
35 // RGB images
36 std::string img_dir_rgb_path = img_dir_path + "/rgb";
37 DIR *dir;
38 if ((dir = opendir(img_dir_rgb_path.c_str())) == nullptr)
39 {
40 throw std::runtime_error("directory " + img_dir_rgb_path + " does not exist");
41 }
42 dirent *dp;
43 for (dp = readdir(dir); dp != nullptr; dp = readdir(dir))
44 {
45 const std::string img_file_name = dp->d_name;
46 if (img_file_name == "." || img_file_name == "..")
47 {
48 continue;
49 }
50
51 img_file_paths_.push_back(img_dir_path + "/rgb/" + img_file_name);
52 }
53 closedir(dir);
54 std::sort(img_file_paths_.begin(), img_file_paths_.end());
55
56 // segmentation mask images
57 std::string img_dir_seg_path = img_dir_path + "/seg";
58 DIR *tdir;
59 if ((tdir = opendir(img_dir_seg_path.c_str())) == nullptr)
60 {
61 throw std::runtime_error("directory " + img_dir_seg_path + " does not exist");
62 }
63 dirent *tdp;
64 for (tdp = readdir(tdir); tdp != nullptr; tdp = readdir(tdir))
65 {
66 const std::string seg_img_file_name = tdp->d_name;
67 if (seg_img_file_name == "." || seg_img_file_name == "..")
68 {
69 continue;
70 }
71
72 mask_file_paths_.push_back(img_dir_path + "/seg/" + seg_img_file_name);
73 }
74 closedir(tdir);
75 std::sort(mask_file_paths_.begin(), mask_file_paths_.end());
76}
77
78std::vector<image_sequence::frame> image_sequence::get_frames() const
79{

Callers

nothing calls this directly

Calls 4

c_strMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected