Skip to content

Commit

Permalink
added c3dc function
Browse files Browse the repository at this point in the history
  • Loading branch information
Erika committed Oct 2, 2024
1 parent e080e46 commit 556b4e8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 37 deletions.
69 changes: 33 additions & 36 deletions relight-pano/panobuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void PanoBuilder::process(Steps starting_step, bool stop){
case ORTHOPLANE: orthoplane(); if(stop) break;
case TARAMA: tarama(); if(stop) break;
case MALT_MEC: malt_mec(); if(stop) break;
case C3DC: c3dc(); if(stop) break;
//case C3DC: c3dc(); if(stop) break;
case MALT_ORTHO: malt_ortho(); if(stop) break;
case TAWNY: tawny(); if(stop) break;
case JPG: jpg(); if(stop) break;
Expand All @@ -179,18 +179,15 @@ void PanoBuilder::rti(){

}
}


//search the subdirectory, the QDir::Dirs | filter QDir::NoDotAndDotDot to get all subdirectories inside the root directory
QStringList subDirs = datasets_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (const QString &subDirName : subDirs) {
QDir subDir(datasets_dir.filePath(subDirName));
break;
//search file .relight
QStringList relightFiles = subDir.entryList(QStringList() << "*.relight", QDir::Files);
if(relightFiles.size()==0)
/*if(relightFiles.size()==0)
throw QString("Missing .relight file in folder " )+ subDir.path();
QString relightFile = relightFiles[0];
QString relightFile = relightFiles[0];*/


QStringList arguments;
Expand Down Expand Up @@ -253,9 +250,32 @@ void PanoBuilder::schnaps(){

QString program = mm3d_path;
QStringList arguments;
arguments << "Schnaps" << ".*jpg";
arguments << "Schnaps" << ".*jpg" << "MoveBadImgs=1";

executeProcess(program, arguments);

QDir poubelleDir(currentDir.filePath("Poubelle"));
if (poubelleDir.exists()) {
QStringList rejectImg = poubelleDir.entryList(QStringList() << "*.jpg" << "*.JPG", QDir::Files);

if (!rejectImg.isEmpty()) {
QString errorMsg = "Error: The following images were moved to Poubelle due to poor alignment:\n";
for (const QString &rejectImgs : rejectImg) {
errorMsg += rejectImgs + "\n";
}
throw errorMsg;
} else {
qDebug() << "All images were successfully aligned. Poubelle directory is empty";
}
} else {
QString poubelleTxtPath = currentDir.filePath("Schnaps_poubelle.txt");
QFile poubelleTxt(poubelleTxtPath);
if (poubelleTxt.exists() && poubelleTxt.size() > 0) {
cout << "No images were moved to Poubelle, but suspicious images are listed in Schnaps_poubelle.txt." << endl;
} else {
cout << "No images were moved to Poubelle, and no suspicious images were found." << endl;
}
}
}

void PanoBuilder::tapas(){
Expand All @@ -274,10 +294,6 @@ void PanoBuilder::tapas(){
}
cout << qPrintable(homolDir.absolutePath()) << endl;

QStringList jpgFiles = currentDir.entryList(QStringList() << "*.jpg" << "*.JPG", QDir::Files);
if (jpgFiles.isEmpty()) {
throw QString("No JPEG images found in photogrammetry directory");
}

QString program = mm3d_path;
QStringList arguments;
Expand All @@ -297,11 +313,6 @@ void PanoBuilder::apericloud(){
}
cout << qPrintable(homolDir.absolutePath()) << endl;

QStringList jpgFiles = currentDir.entryList(QStringList() << "*.jpg" << "*.JPG", QDir::Files);
if (jpgFiles.isEmpty()) {
throw QString("No JPEG images found in photogrammetry directory");
}

QString program = mm3d_path;
QStringList arguments;
arguments << "AperiCloud" << ".*jpg" << "Relative";
Expand Down Expand Up @@ -387,11 +398,6 @@ void PanoBuilder::tarama(){
}
cout << qPrintable(oriAbs.absolutePath()) << endl;

QStringList jpgFiles = currentDir.entryList(QStringList() << "*.jpg" << "*.JPG", QDir::Files);
if (jpgFiles.isEmpty()) {
throw QString("No JPEG images found in photogrammetry directory");
}

QString program = mm3d_path;
QStringList arguments;
arguments << "Tarama" << ".*jpg" << "Abs";
Expand All @@ -411,15 +417,10 @@ void PanoBuilder::malt_mec(){
}
cout << qPrintable(taDir.absolutePath()) << endl;

QStringList jpgFiles = currentDir.entryList(QStringList() << "*.jpg" << "*.JPG", QDir::Files);
if (jpgFiles.isEmpty()) {
throw QString("No JPEG images found in photogrammetry directory");
}

QString program = mm3d_path;
QStringList arguments;
arguments << "Malt" << "Ortho" << ".*jpg" << "Abs" << "ZoomF=4" << "DirMEC=Malt"
<< "DirTA=TA" << "ImOrtho=.*jpg" << "DirOF=Ortho-Lights" << "NbVI=2";
arguments << "Malt" << "Ortho" << ".*jpg" << "Relative" << "ZoomF=4" << "DirMEC=Malt"
<< "DirTA=TA" << "ImOrtho=.*jpg" << "DirOF=Ortho-Lights" << "NbVI=3" << "Purge=true";

executeProcess(program, arguments);

Expand All @@ -436,7 +437,7 @@ void PanoBuilder::malt_mec(){
}
}

void PanoBuilder::c3dc(){
/*void PanoBuilder::c3dc(){
//prende l'input dalla sottodirectory
QDir currentDir = cd("photogrammetry");
Expand All @@ -447,17 +448,13 @@ void PanoBuilder::c3dc(){
//}
//cout << qPrintable(taDir.absolutePath()) << endl;
QStringList jpgFiles = currentDir.entryList(QStringList() << "*.jpg" << "*.JPG", QDir::Files);
if (jpgFiles.isEmpty()) {
throw QString("No JPEG images found in photogrammetry directory");
}

QString program = mm3d_path;
QStringList arguments;
arguments << "C3DC" << "MicMac" << ".*jpg" << "Abs" <<"DefCor=0.01";
executeProcess(program, arguments);
}
*/

void PanoBuilder::malt_ortho(){
//prende l'input dalla sottodirectory
Expand Down Expand Up @@ -530,7 +527,7 @@ void PanoBuilder::malt_ortho(){

QString program = mm3d_path;
QStringList arguments;
arguments << "Malt" << "Ortho" << ".*jpg" << "Abs" << "ZoomF=4"
arguments << "Malt" << "Ortho" << ".*jpg" << "Relative" << "ZoomF=4"
<< "DirMEC=Malt" << "DirTA=TA" << "DoMEC=0" << "DoOrtho=1"
<< "ImOrtho=.*jpg" << "DirOF="+orthoPlaneDirName;

Expand Down Expand Up @@ -561,7 +558,7 @@ void PanoBuilder::tawny(){
cout << "Directory " << qPrintable(orthoDir.absolutePath()) << " does not exist." << endl;
continue;
}
QStringList tifFiles = orthoDir.entryList(QStringList() << "Ort_Face_*.tif", QDir::Files);
QStringList tifFiles = orthoDir.entryList(QStringList() << "Ort_*.tif", QDir::Files);
if (tifFiles.isEmpty()) {
cout << "No .tif files in " << qPrintable(orthoDir.absolutePath()) << endl;
continue;
Expand Down
2 changes: 1 addition & 1 deletion relight-pano/panobuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PanoBuilder : public QObject
JPG //convert to jpg
};

QStringList steps = {"rti", "tapioca", "schnaps", "tapas", "apericloud", "orthoplane", "tarama", "malt_mec", "c3dc", "malt_ortho", "tawny", "jpg", "updateJson"};
QStringList steps = {"rti", "tapioca", "schnaps", "tapas", "apericloud", "orthoplane", "tarama", "malt_mec", "c3dc" "malt_ortho", "tawny", "jpg", "updateJson"};
QDir base_dir;
QDir datasets_dir;
QString mm3d_path;
Expand Down

0 comments on commit 556b4e8

Please sign in to comment.