@@ -40,14 +40,12 @@ Header-MicMac-eLiSe-25/06/2007*/
40
40
#include " StdAfx.h"
41
41
#include " schnaps.h"
42
42
43
- template <typename T>
44
- std::string NumberToString ( T Number )
43
+ template <typename T> string NumberToString (T Number)
45
44
{
46
- std:: ostringstream ss;
45
+ ostringstream ss;
47
46
ss << Number;
48
- return ss.str ();
47
+ return ss.str ();
49
48
}
50
-
51
49
// ----------------------------------------------------------------------------
52
50
struct Couple {
53
51
std::string Img1;
@@ -183,6 +181,7 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
183
181
int aProj=0 ;
184
182
double aFov=50 ;
185
183
bool aFilter=true ;
184
+ bool aClean=true ;
186
185
187
186
ElInitArgMain
188
187
(
@@ -194,6 +193,7 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
194
193
<< EAM (aProj," Proj" ,false ," Projection type (default: 0)" )
195
194
<< EAM (aFov," FOV" ,false ," Horizontal field of view of images (default: 50)" )
196
195
<< EAM (aFilter," FilterTP" ,true ," Use Schnaps to reduce tie points; Def=true" )
196
+ << EAM (aClean," Clean" ,true ," Clean indivudual images after stitching ; Def=true" )
197
197
);
198
198
199
199
// !!!!!!!! sort directories by name !!!!!!!
@@ -257,12 +257,12 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
257
257
258
258
for (unsigned int aV=0 ; aV<aLFiles.size (); aV++)
259
259
{
260
- std::cout << " Copy images of groupe : " << aV << std::endl;
260
+ std::cout << " Copy images of groupe " << aV+ 1 << " out of " << aLFiles. size () << " groups " << std::endl;
261
261
int aCompt = 1 ;
262
262
for (std::list<cElFilename>::iterator iT2 = aLFiles.at (aV).begin () ; iT2 != aLFiles.at (aV).end () ; iT2++)
263
263
{
264
264
std::cout << " ---> Copy of file " << aCompt << " out of " << aLFiles.at (aV).size () << std::endl;
265
- ELISE_fp::CpFile ((*iT2).m_path .str () + (*iT2).m_basename ,aNameProcFolder); // copy only if no file !!!!
265
+ ELISE_fp::CpFile ((*iT2).m_path .str () + (*iT2).m_basename ,aNameProcFolder); // to do : copy only if no file !!!!
266
266
aCompt++;
267
267
}
268
268
}
@@ -274,16 +274,20 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
274
274
ctPath aNWDir = getWorkingDirectory ();
275
275
std::cout << " aNWDir = " << aNWDir << std::endl;
276
276
}
277
+
278
+ // vector of names of signe mosaic for each level
279
+ std::vector<std::string> aVOM;
280
+
281
+ // lauch all the commands in //
282
+ std::list<std::string> aListCom;
277
283
278
- // pipeline to generate a pano for each level N
284
+ // pipeline to generate a pano for each level N :
285
+ // first tie points extraction using MicMac
279
286
for (unsigned int aP=0 ; aP<aDirectories.size (); aP++)
280
287
{
281
- std::cout << " debugggggg" << std::endl;
282
288
std::string aPatL = GenPatFromLF (aLFiles.at (aP),false );
283
- std::cout << " debugggggg" << std::endl;
284
289
// std::string aPatL2 = GenPatFromLF(aLFiles.at(aP+1),false);
285
- std::cout << " debugggggg" << std::endl;
286
- std::string aXmlOutFile = " NameCple_" + NumberToString (aP) + " _" + NumberToString (aP+1 ) + " .xml" ;
290
+ std::string aXmlOutFile = " NameCple_" + NumberToString (aP) + " .xml" ;
287
291
std::cout << " aXmlOutFile = " << aXmlOutFile << std::endl;
288
292
289
293
// generate a .xml file of all couples for level N & level N+1
@@ -332,7 +336,7 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
332
336
std::string aPatLH = GenPatFromLF (aLFiles.at (aP),true );
333
337
// std::string aPatL2H = GenPatFromLF(aLFiles.at(aP+1),true);
334
338
335
- std::string aHNameProject = " Hugin_" + NumberToString (aP) + " _ " + NumberToString (aP+ 1 ) + " .pto" ;
339
+ std::string aHNameProject = " Hugin_" + NumberToString (aP) + " .pto" ;
336
340
std::string aCom3 = " pto_gen -o"
337
341
+ std::string (" " )
338
342
+ aHNameProject
@@ -344,7 +348,7 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
344
348
+ std::string (" " )
345
349
+ " -f " + NumberToString (aFov);
346
350
std::cout << " aCom3 = " << aCom3 << std::endl;
347
- system_call (aCom3.c_str ());
351
+ // ~ system_call(aCom3.c_str());
348
352
349
353
// specify the variables to be optimized
350
354
std::string aCom4 = " pto_var --opt=\" y, p, r, TrX, TrY, TrZ, Tpy, Tpp, v, a, b, c, d, e, g, t, Eev, Er, Eb, Vb, Vc, Vd, Vx, Vy, Ra, Rb, Rc, Rd, Re\" "
@@ -353,7 +357,7 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
353
357
+ std::string (" " )
354
358
+ aHNameProject;
355
359
std::cout << " aCom4 = " << aCom4 << std::endl;
356
- system_call (aCom4.c_str ());
360
+ // ~ system_call(aCom4.c_str());
357
361
358
362
// include tie points from MicMac in the project file
359
363
std::string aCom5 = MMDir ()
@@ -368,7 +372,7 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
368
372
+ std::string (" " )
369
373
+ " HomolIn=_mini" ;
370
374
std::cout << " aCom5 = " << aCom5 << std::endl;
371
- system_call (aCom5.c_str ());
375
+ // ~ system_call(aCom5.c_str());
372
376
373
377
// lanch Hugin optimizer
374
378
std::string aCom6 = " autooptimiser -a -l -s -m -v"
@@ -377,31 +381,71 @@ cOSPTPE_Appli::cOSPTPE_Appli(int argc,char ** argv)
377
381
+ " -o " + StdPrefixGen (aHNameProject) + " _Homol.pto"
378
382
+ std::string (" " ) + StdPrefixGen (aHNameProject) + " _Homol.pto" ;
379
383
std::cout << " aCom6 = " << aCom6 << std::endl;
380
- system_call (aCom6.c_str ());
384
+ // ~ system_call(aCom6.c_str());
381
385
382
386
// pano configuration
383
387
std::string aCom7 = " pano_modify -p " + NumberToString (aProj)
384
388
+ std::string (" " ) + " -o "
385
389
+ StdPrefixGen (aHNameProject) + " _Homol.pto"
386
390
+ std::string (" " ) + StdPrefixGen (aHNameProject) + " _Homol.pto" ;
387
391
std::cout << " aCom7 = " << aCom7 << std::endl;
388
- system_call (aCom7.c_str ());
392
+ // ~ system_call(aCom7.c_str());
389
393
390
394
// generate individual images to be stiched
391
- std::string aCom8 = " nona -z LZW -r ldr -m TIFF_m -o ImgsIndiv_" + NumberToString (aP) + " _" + NumberToString (aP+ 1 ) + " _ " + std::string (" " ) + StdPrefixGen (aHNameProject) + " _Homol.pto" ;
395
+ std::string aCom8 = " nona -z LZW -r ldr -m TIFF_m -o ImgsIndiv_" + NumberToString (aP) + " _" + std::string (" " ) + StdPrefixGen (aHNameProject) + " _Homol.pto" ;
392
396
std::cout << " aCom8 = " << aCom8 << std::endl;
393
- system_call (aCom8.c_str ());
397
+ // ~ system_call(aCom8.c_str());
394
398
395
399
// assembly for level N & level N+1
396
- std::string aOutMosaic = " Mosaic_" + NumberToString (aP) + " _" + NumberToString (aP+1 ) + " .jpg" ;
397
- std::string aCom9 = " enblend --compression=90 ImgsIndiv_" + NumberToString (aP) + " _" + NumberToString (aP+1 ) + " *.*tif -o " + aOutMosaic;
400
+ std::string aOutMosaic = " Mosaic_" + NumberToString (aP) + " .jpg" ;
401
+ aVOM.push_back (aOutMosaic);
402
+ std::string aCom9 = " enblend --compression=90 ImgsIndiv_" + NumberToString (aP) + " *.*tif -o " + aOutMosaic;
398
403
std::cout << " aCom9 = " << aCom9 << std::endl;
399
- system_call (aCom9.c_str ());
404
+ // ~ system_call(aCom9.c_str());
405
+
406
+ // merge all in one commande
407
+ std::string aComM = aCom3
408
+ + std::string (" " ) + " &&" + std::string (" " )
409
+ + aCom4
410
+ + std::string (" " ) + " &&" + std::string (" " )
411
+ + aCom5
412
+ + std::string (" " ) + " &&" + std::string (" " )
413
+ + aCom6
414
+ + std::string (" " ) + " &&" + std::string (" " )
415
+ + aCom7
416
+ + std::string (" " ) + " &&" + std::string (" " )
417
+ + aCom8
418
+ + std::string (" " ) + " &&" + std::string (" " )
419
+ + aCom9;
420
+
421
+ std::cout << " aComM = " << aComM << std::endl;
422
+ aListCom.push_back (aComM);
423
+ }
424
+
425
+ cEl_GPAO::DoComInParal (aListCom,mDir );
426
+
427
+ if (aClean)
428
+ {
429
+ cInterfChantierNameManipulateur * aII = cInterfChantierNameManipulateur::BasicAlloc (mDir );
430
+ std::string aFPII = " ImgsIndiv_*.*tif" ;
431
+ const std::vector<std::string> * aSII = aII->Get (aFPII);
432
+ std::vector<std::string> aVII = *aSII;
433
+ std::cout << " aVII.size() = " << aVII.size () << std::endl;
434
+
435
+ for (unsigned int aC=0 ; aC<aVII.size (); aC++)
436
+ {
437
+ std::cout << " ---> Deleting Image " << aC << " out of " << aVII.size () << " : " << aVII[aC] << std::endl;
438
+ ELISE_fp::RmFileIfExist (aVII[aC]);
439
+ }
400
440
}
401
441
402
442
// same pipeline to generate a global panoramique from each individual (level N & level N+1 pano)
443
+ for (unsigned int aL=0 ; aL<aVOM.size (); aL++)
403
444
{
404
445
// generate a .xml file of all individual panoramik
446
+ // ~ std::list<cElFilename> aLMN;
447
+ // ~ aLMN.push_back(
448
+ // ~ std::string aPatL = GenPatFromLF(aLMN,false);
405
449
406
450
// compute tie points for all individual panoramik
407
451
0 commit comments