@@ -344,7 +344,7 @@ int CreateGCPs_main(int argc,char ** argv)
344
344
return EXIT_SUCCESS;
345
345
}
346
346
347
- void CreateGCPs4Init11p (std::string aDir, std::string aImgList, std::string aOri, int aGridX, int aGridY, int aGridZ, std::string aOut2DXml, std::string aOut3DXml)
347
+ void CreateGCPs4Init11p (std::string aDir, std::string aImgList, std::string aOri, int aGridX, int aGridY, int aGridZ, std::string aOut2DXml, std::string aOut3DXml, double aZmin, double aZmax )
348
348
{
349
349
cCommonAppliTiepHistorical aCAS3D;
350
350
@@ -366,8 +366,22 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
366
366
367
367
double dZSol = aCamL->GetAltiSol ();
368
368
// Pt2dr aMinMax = Pt2dr(dZSol, dZSol); //aCamL->GetAltiSolMinMax();
369
- Pt2dr aMinMax = aCamL->GetAltiSolMinMax ();
370
- printf (" aMinMax, dZSol: %lf, %lf, %lf\n " , aMinMax.x , aMinMax.y , dZSol);
369
+ if (aZmin > 99999 && aZmax < -99999 )
370
+ {
371
+ // if(ELISE_ASSERT(false,"cBasicGeomCap3D::GetAltiSolMinMax");)
372
+ if (aCamL->AltisSolMinMaxIsDef () == false )
373
+ {
374
+ printf (" \n ****************************************Command Failed***************************************\n " );
375
+ printf (" Please input Minimal and Maximal altitude value of the scene by setting the Named args Zmin and Zmax.\n " );
376
+ printf (" The average altitude of the scene is %.2f.\n " , aCamL->GetAltiSol ());
377
+ printf (" *********************************************************************************************\n " );
378
+ return ;
379
+ }
380
+ Pt2dr aMinMax = aCamL->GetAltiSolMinMax ();
381
+ aZmin = aMinMax.x ;
382
+ aZmax = aMinMax.y ;
383
+ }
384
+ printf (" Minimal, Maximal and Average altitude value of the scene:\n %.2lf, %.2lf, %.2lf\n " , aZmin, aZmax, dZSol);
371
385
372
386
cMesureAppuiFlottant1Im aMAF;
373
387
aMAF.NameIm () = aImg1;
@@ -377,7 +391,7 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
377
391
int nBorder = 5 ; // in case backprojected point is out of frame
378
392
double dIntervalX = (ImgSz.x -nBorder*2 )/aGridX;
379
393
double dIntervalY = (ImgSz.y -nBorder*2 )/aGridY;
380
- double dIntervalZ = (aMinMax. x -aMinMax. y )/aGridZ;
394
+ double dIntervalZ = (aZmax-aZmin )/aGridZ;
381
395
382
396
int nImgX, nImgY;
383
397
double dZ;
@@ -389,8 +403,8 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
389
403
nImgY = int (dIntervalY*j) + nBorder;
390
404
for (int k=0 ; k<aGridZ; k++)
391
405
{
392
- dZ = aMinMax. x + dIntervalZ*k;
393
- printf (" i, j, k, dZ: %d, %d, %d, %lf\n " , i, j, k, dZ);
406
+ dZ = aZmin + dIntervalZ*k;
407
+ // printf("i, j, k, dZ: %d, %d, %d, %lf\n", i, j, k, dZ);
394
408
Pt3dr aVGCP = aCamL->ImEtZ2Terrain (Pt2dr (nImgX, nImgY), dZ);
395
409
vPt3D.push_back (aVGCP);
396
410
@@ -407,6 +421,8 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
407
421
}
408
422
MakeFileXML (aSOMAFout, aOut2DXml);
409
423
Save3DXml (vPt3D, aOut3DXml);
424
+ printf (" \n ****************************************Command Succeeded***************************************\n " );
425
+ printf (" The results are saved in %s and %s.\n " , aOut2DXml.c_str (), aOut3DXml.c_str ());
410
426
}
411
427
412
428
/* *****************************CreateGCPs4Init11p********************************/
@@ -421,6 +437,9 @@ int CreateGCPs4Init11p_main(int argc,char ** argv)
421
437
int aGridY = 10 ;
422
438
int aGridZ = 3 ;
423
439
440
+ double aZmin = 9999999999 ;
441
+ double aZmax = -9999999999 ;
442
+
424
443
std::string aOut2DXml = " GCPs4Init11p_2D.xml" ;
425
444
std::string aOut3DXml = " GCPs4Init11p_3D.xml" ;
426
445
@@ -434,14 +453,16 @@ int CreateGCPs4Init11p_main(int argc,char ** argv)
434
453
<< EAMC (aOri," Orientation of input images" ),
435
454
LArgMain ()
436
455
<< EAM (aDir," Dir" ,true ," Work directory, Def=./" )
437
- << EAM (aGridX," GridX" ,true ," How many grids do you want in the direction of width in image frame to generate virtual GCPs." )
438
- << EAM (aGridY," GridY" ,true ," How many grids do you want in the direction of height in image frame to generate virtual GCPs." )
439
- << EAM (aGridZ," GridZ" ,true ," How many grids do you want in the direction of altitude in 3D to generate virtual GCPs." )
456
+ << EAM (aGridX," GridX" ,true ," How many grids do you want in the direction of width in image frame to generate virtual GCPs, Def=10 ." )
457
+ << EAM (aGridY," GridY" ,true ," How many grids do you want in the direction of height in image frame to generate virtual GCPs, Def=10 ." )
458
+ << EAM (aGridZ," GridZ" ,true ," How many grids do you want in the direction of altitude in 3D to generate virtual GCPs, Def=3 ." )
440
459
<< EAM (aOut2DXml," Out2DXml" ,true ," Output xml files of 2D obersevations of the virtual GCPs, Def=GCPs4Init11p_2D.xml" )
441
460
<< EAM (aOut3DXml," Out3DXml" ,true ," Output xml files of 3D obersevations of the virtual GCPs, Def=GCPs4Init11p_3D.xml" )
461
+ << EAM (aZmin," Zmin" ,true ," Minimal altitude value of the scene, Def=none." )
462
+ << EAM (aZmax," Zmax" ,true ," Maximal altitude value of the scene, Def=none." )
442
463
);
443
464
444
- CreateGCPs4Init11p (aDir, aImgList, aOri, aGridX, aGridY, aGridZ, aOut2DXml, aOut3DXml);
465
+ CreateGCPs4Init11p (aDir, aImgList, aOri, aGridX, aGridY, aGridZ, aOut2DXml, aOut3DXml, aZmin, aZmax );
445
466
446
467
return EXIT_SUCCESS;
447
468
}
0 commit comments