Read in image file sequence in C++ w/o using opencv -
Read in image file sequence in C++ w/o using opencv -
given image files
lights000.rgbe lights001.rgbe lights002.rgbe ... lights899.rgbe
are located in single subfolder. best way read 1 file next?
given read command .rgbe
called readhdr(char* filename)
i have seen several questions regrading problem utilize opencv. not using opencv , .rgbe
not supported opencv file extension method wouldn't work.
i saw next code different question:
char* dataset_dir( "c:/data/" ); // or take argv[1] cv::mat normal_matrix; std::vector<cv::mat>* image_stack; for( int i=1; i<=endnumber; ++i ) { // gives entire stack of images go through image_stack->push_back(cv::imread(std::format("%s/%03d-capture.png", dataset, i), cv_load_image_color)); normal_matrix = cv::imread(std::format("%s/%03d-capture.png", dataset, i), cv_load_image_color); }
but cannot find info on std::format command or dataset_dir.
any advice how split file name string 3 parts helpful.
split into:
char name = "lights"; int num = "000"; char file = ".rgbe;
here's simple solution, how split filename strings criteria specified:
#include <iostream> #include <string> #include <sstream> using namespace std; int main() { istringstream filename("lights042.rgbe"); string name; int num; string file; while(filename && !isdigit(filename.peek())) { char c; filename >> c; name += c; } filename >> num; filename >> file; cout << "name = '" << name << "'" << endl; cout << "num = " << num << endl; cout << "file = '" << file << "'" << endl; homecoming 0; }
output
name = 'lights' num = 42 file = '.rgbe'
see live demo please.
c++
Comments
Post a Comment