mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 10:00:23 +08:00
ImagesJoiner tool: can now merge images from two folders
This commit is contained in:
@@ -37,6 +37,7 @@ void showUsage()
|
|||||||
{
|
{
|
||||||
printf("Usage:\n"
|
printf("Usage:\n"
|
||||||
"imagesJoiner.exe [option] path\n"
|
"imagesJoiner.exe [option] path\n"
|
||||||
|
"imagesJoiner.exe path_left path_right\n"
|
||||||
" Options:\n"
|
" Options:\n"
|
||||||
" -inv option for copying odd images on the right\n\n");
|
" -inv option for copying odd images on the right\n\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -58,15 +59,33 @@ int main(int argc, char * argv[])
|
|||||||
printf(" Inversing option activated...\n");
|
printf(" Inversing option activated...\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(argc > 3)
|
||||||
|
{
|
||||||
showUsage();
|
showUsage();
|
||||||
printf(" Not recognized option: \"%s\"\n", argv[i]);
|
printf(" Not recognized option: \"%s\"\n", argv[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string path = argv[argc-1];
|
std::string path, pathRight;
|
||||||
|
|
||||||
|
if(argc == 3 && !inv)
|
||||||
|
{
|
||||||
|
//two paths
|
||||||
|
path = argv[1];
|
||||||
|
pathRight = argv[2];
|
||||||
|
|
||||||
|
printf(" Path left = %s\n", path.c_str());
|
||||||
|
printf(" Path right = %s\n", pathRight.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = argv[argc-1];
|
||||||
printf(" Path = %s\n", path.c_str());
|
printf(" Path = %s\n", path.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
UDirectory dir(path, "jpg bmp png tiff jpeg");
|
UDirectory dir(path, "jpg bmp png tiff jpeg");
|
||||||
if(!dir.isValid())
|
UDirectory dirRight(pathRight, "jpg bmp png tiff jpeg");
|
||||||
|
if(!dir.isValid() || (!pathRight.empty() && !dirRight.isValid()))
|
||||||
{
|
{
|
||||||
printf("Path invalid!\n");
|
printf("Path invalid!\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@@ -78,7 +97,15 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
|
|
||||||
std::string fileNameA = dir.getNextFilePath();
|
std::string fileNameA = dir.getNextFilePath();
|
||||||
std::string fileNameB = dir.getNextFilePath();
|
std::string fileNameB;
|
||||||
|
if(dirRight.isValid())
|
||||||
|
{
|
||||||
|
fileNameB = dirRight.getNextFilePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileNameB = dir.getNextFilePath();
|
||||||
|
}
|
||||||
|
|
||||||
int i=1;
|
int i=1;
|
||||||
while(!fileNameA.empty() && !fileNameB.empty())
|
while(!fileNameA.empty() && !fileNameB.empty())
|
||||||
@@ -124,8 +151,15 @@ int main(int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileNameA = dir.getNextFilePath();
|
fileNameA = dir.getNextFilePath();
|
||||||
|
if(dirRight.isValid())
|
||||||
|
{
|
||||||
|
fileNameB = dirRight.getNextFilePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fileNameB = dir.getNextFilePath();
|
fileNameB = dir.getNextFilePath();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Error: loading images failed!\n");
|
printf("Error: loading images failed!\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user