MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / readImageDirIfFlagEnabled

Function readImageDirIfFlagEnabled

rtpose_wrapper/apps/rtpose.cpp:2407–2434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2405}
2406
2407int readImageDirIfFlagEnabled()
2408{
2409 // Open & read image dir if present
2410 if (!_image_dir.empty()) {
2411 std::string folderName = _image_dir;
2412 if ( !boost::filesystem::exists( folderName ) ) {
2413 LOG(ERROR) << "Folder " << folderName << " does not exist.";
2414 return -1;
2415 }
2416 boost::filesystem::directory_iterator end_itr; // default construction
2417 // yields past-the-end
2418 for ( boost::filesystem::directory_iterator itr( folderName );
2419 itr != end_itr; ++itr ) {
2420 if ( boost::filesystem::is_directory(itr->status()) ) {
2421 // Skip directories
2422 } else if (itr->path().extension()==".jpg" ||
2423 itr->path().extension()==".png" ||
2424 itr->path().extension()==".bmp") {
2425 // std::string filename = itr->path().string();
2426 global.image_list.push_back( itr->path().string() );
2427 }
2428 }
2429 std::sort(global.image_list.begin(), global.image_list.end());
2430 CHECK_GE(global.image_list.size(),0);
2431 }
2432
2433 return 0;
2434}
2435
2436int main(int argc, char *argv[]) {
2437

Callers 1

mainFunction · 0.85

Calls 4

statusMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected