Skip to content

Commit

Permalink
Merge pull request #247 from micmacIGN/md-ExportMesIm_CodedTargetExtract
Browse files Browse the repository at this point in the history
Add export mesIm in cExtractTarget
  • Loading branch information
mdaakir committed Apr 24, 2024
2 parents 89a8e95 + 6704a8f commit 765d4b7
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions MMVII/src/CodedTarget/cExtractTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <typeinfo>
#include <iostream>
#include <fstream>

#include "MMVII_Sensor.h"

#include "MMVII_PhgrDist.h"
using namespace NS_SymbolicDerivative;
Expand Down Expand Up @@ -102,6 +102,7 @@ class cAppliExtractCodeTarget : public cMMVII_Appli,
std::vector<cPt2dr> extractButterflyEdge(const cDataIm2D<float> &, cDCT*);
std::vector<cPt2dr> extractButterflyEdgeOld(const cDataIm2D<float> &, cDCT*);
void exportInXml(std::vector<cDCT*>);
void exportMesIm();
void plotDebugImage(cDCT*, const cDataIm2D<float>&);
tImTarget generateRectifiedImage(cDCT*, const cDataIm2D<float>&);
std::vector<cPt2dr> getEncodingPositions(tDataImT &, cDCT*);
Expand Down Expand Up @@ -208,6 +209,7 @@ class cAppliExtractCodeTarget : public cMMVII_Appli,
int mSizeYDrone;
int mSizeXDroneSym;
int mSizeYDroneSym;
cPhotogrammetricProject mPhProj;

};

Expand Down Expand Up @@ -260,7 +262,8 @@ cAppliExtractCodeTarget::cAppliExtractCodeTarget(const std::vector<std::string>
mSizeXDrone (600),
mSizeYDrone (1096),
mSizeXDroneSym (600),
mSizeYDroneSym (848)
mSizeYDroneSym (848),
mPhProj (*this)
{
}

Expand Down Expand Up @@ -303,6 +306,7 @@ cCollecSpecArg2007 & cAppliExtractCodeTarget::ArgOpt(cCollecSpecArg2007 & anArgO
<< AOpt2007(mLineWidthDebug, "Line", "Size of lines in debug plot", {eTA2007::HDV})
<< AOpt2007(mLetter, "Letter", "Size of letters in debug plot", {eTA2007::HDV})
<< AOpt2007(mGroundTruthFile, "GT", "Ground truth file (if any)", {eTA2007::HDV})
<< mPhProj.DPPointsMeasures().ArgDirOutOptWithDef("Std")
);
;
}
Expand Down Expand Up @@ -647,12 +651,19 @@ void cAppliExtractCodeTarget::DoExtract(){
// ------------------------------------------------
// Xml output (if needed)
// ------------------------------------------------
if (mXml != "") exportInXml(mVDCTOk);
if (mXml != "")
{
exportInXml(mVDCTOk);
}


// ------------------------------------------------
// Plot debug if needed
// ------------------------------------------------
if (mDebugPlot) mImVisu.ToFile("VisuCodeTarget.tif");
if (mDebugPlot)
{
mImVisu.ToFile(mPhProj.DirVisu() + mNameIm + "_" + "VisuCodeTarget.tif");
}

}

Expand Down Expand Up @@ -682,7 +693,34 @@ void cAppliExtractCodeTarget::exportInXml(std::vector<cDCT*> mVDCTOk){

}

// ---------------------------------------------------------------------------
// Function to export result in xml MMVII
// ---------------------------------------------------------------------------
void cAppliExtractCodeTarget::exportMesIm()
{
cSetMesPtOf1Im aSetMes(FileOfPath(mNameIm));

for(auto aDCT : mVDCTOk)
{
std::string aGcpName = aDCT->mDecodedName;

cPt2dr aPtIm;
aPtIm.x() = aDCT->mRefinedCenter.x();
aPtIm.y() = aDCT->mRefinedCenter.y();

if((aDCT->mDecodedName != "") && (aDCT->mDecodedName.substr(0,2) != "NA"))
{
//fill aSetMesOut
cMesIm1Pt aMesIm1Pt(aPtIm,aGcpName,1.0);
aSetMes.AddMeasure(aMesIm1Pt);
}


}

//write in a file
mPhProj.SaveMeasureIm(aSetMes);
}

// ---------------------------------------------------------------------------
// Function to test if a predetected DCT candidate is valid
Expand Down Expand Up @@ -1959,6 +1997,8 @@ int cAppliExtractCodeTarget::ExeOnParsedBox()

int cAppliExtractCodeTarget::Exe(){

mPhProj.FinishInit();


if (mTest){

Expand Down Expand Up @@ -2072,6 +2112,7 @@ int cAppliExtractCodeTarget::Exe(){

APBI_ExecAll(); // run the parse file SIMPL

exportMesIm();

delete mSpec;
return EXIT_SUCCESS;
Expand Down

0 comments on commit 765d4b7

Please sign in to comment.