@@ -344,7 +344,7 @@ int CreateGCPs_main(int argc,char ** argv)
344344 return EXIT_SUCCESS;
345345}
346346
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 )
348348{
349349 cCommonAppliTiepHistorical aCAS3D;
350350
@@ -366,8 +366,22 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
366366
367367 double dZSol = aCamL->GetAltiSol ();
368368 // 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);
371385
372386 cMesureAppuiFlottant1Im aMAF;
373387 aMAF.NameIm () = aImg1;
@@ -377,7 +391,7 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
377391 int nBorder = 5 ; // in case backprojected point is out of frame
378392 double dIntervalX = (ImgSz.x -nBorder*2 )/aGridX;
379393 double dIntervalY = (ImgSz.y -nBorder*2 )/aGridY;
380- double dIntervalZ = (aMinMax. x -aMinMax. y )/aGridZ;
394+ double dIntervalZ = (aZmax-aZmin )/aGridZ;
381395
382396 int nImgX, nImgY;
383397 double dZ;
@@ -389,8 +403,8 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
389403 nImgY = int (dIntervalY*j) + nBorder;
390404 for (int k=0 ; k<aGridZ; k++)
391405 {
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);
394408 Pt3dr aVGCP = aCamL->ImEtZ2Terrain (Pt2dr (nImgX, nImgY), dZ);
395409 vPt3D.push_back (aVGCP);
396410
@@ -407,6 +421,8 @@ void CreateGCPs4Init11p(std::string aDir, std::string aImgList, std::string aOri
407421 }
408422 MakeFileXML (aSOMAFout, aOut2DXml);
409423 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 ());
410426}
411427
412428/* *****************************CreateGCPs4Init11p********************************/
@@ -421,6 +437,9 @@ int CreateGCPs4Init11p_main(int argc,char ** argv)
421437 int aGridY = 10 ;
422438 int aGridZ = 3 ;
423439
440+ double aZmin = 9999999999 ;
441+ double aZmax = -9999999999 ;
442+
424443 std::string aOut2DXml = " GCPs4Init11p_2D.xml" ;
425444 std::string aOut3DXml = " GCPs4Init11p_3D.xml" ;
426445
@@ -434,14 +453,16 @@ int CreateGCPs4Init11p_main(int argc,char ** argv)
434453 << EAMC (aOri," Orientation of input images" ),
435454 LArgMain ()
436455 << 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 ." )
440459 << EAM (aOut2DXml," Out2DXml" ,true ," Output xml files of 2D obersevations of the virtual GCPs, Def=GCPs4Init11p_2D.xml" )
441460 << 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." )
442463 );
443464
444- CreateGCPs4Init11p (aDir, aImgList, aOri, aGridX, aGridY, aGridZ, aOut2DXml, aOut3DXml);
465+ CreateGCPs4Init11p (aDir, aImgList, aOri, aGridX, aGridY, aGridZ, aOut2DXml, aOut3DXml, aZmin, aZmax );
445466
446467 return EXIT_SUCCESS;
447468}
0 commit comments