diff --git a/MMVII/Doc/Doc2007.tex b/MMVII/Doc/Doc2007.tex index 292d53c19c..ad49e9120f 100755 --- a/MMVII/Doc/Doc2007.tex +++ b/MMVII/Doc/Doc2007.tex @@ -151,6 +151,13 @@ \newcommand{\UNCLEAR}{} \newcommand{\ISITCLEAR}{} \newcommand{\PPP}{MMVII} + +\newcommand{\MmVii} +{ +\ensuremath{ \mbox{ + {\bf $\mathcal{M}$}\hspace{-0.15em}\raisebox{-0.4ex}{$m$}\hspace{-0.3em}\raisebox{0.3ex}{$V$}\raisebox{-0.4ex}{$2$} +}}} + \newcommand{\CdPPP}{{\tt MMVII}} \newcommand{\MMVIDIR}{{\tt MMVII-MainFolder/}} \newcommand{\doxy}{\emph{doxygen}} @@ -158,6 +165,7 @@ %\includeonly{Methods/PoseGlobInit} %\includeonly{Programmer/Interpolators} +\includeonly{Methods/LidarImageRegistration} %--------------------------------------------- \begin{document} @@ -196,6 +204,7 @@ \part{Methodologies} \include{Methods/PushBroomSensor-Theory} \include{Methods/PoseEstimation} \include{Methods/PoseGlobInit} +\include{Methods/LidarImageRegistration} \include{Methods/CodedTarget-Theory} \include{Methods/Line-Detection-Theory} \include{Methods/AimeDesc} diff --git a/MMVII/Doc/Programmer/Interpolators.tex b/MMVII/Doc/Programmer/Interpolators.tex index d09f1a9ae1..d049260877 100755 --- a/MMVII/Doc/Programmer/Interpolators.tex +++ b/MMVII/Doc/Programmer/Interpolators.tex @@ -801,6 +801,8 @@ \subsubsection{{\tt GetValueInterpol}} \subsubsection{{\tt GetValueAndGradInterpol}} +\label{Method:GetValueAndGradInterpol} + {\tt std::pair GetValueAndGradInterpol(const cDiffInterpolator1D \&,const cPt2dr \& aP) const ;} The method is similar to {\tt GetValueInterpol}, but instead of returning only the values, it diff --git a/MMVII/Doc/Programmer/NonLinearOptim.tex b/MMVII/Doc/Programmer/NonLinearOptim.tex index 254782e1d4..b912fbc3ba 100755 --- a/MMVII/Doc/Programmer/NonLinearOptim.tex +++ b/MMVII/Doc/Programmer/NonLinearOptim.tex @@ -224,6 +224,8 @@ \subsection{Motivation} \subsection{class for specifying the formulas} +\label{Class:Specif:Formulas} + In this example, we have only one formula we need to compute and derivate, it's the formula of equation~\ref{EqConsDist}. First introduce a bit of MMVII's jargon : diff --git a/MMVII/include/MMVII_Clino.h b/MMVII/include/MMVII_Clino.h index 9528f11cab..55bcc150ec 100755 --- a/MMVII/include/MMVII_Clino.h +++ b/MMVII/include/MMVII_Clino.h @@ -65,6 +65,8 @@ class cSetMeasureClino void SetNames(const std::vector &); + void FilterByPatIdent(const std::string& aPat); + private : std::vector mNamesClino; std::string mPatMatch; diff --git a/MMVII/include/MMVII_MeasuresIm.h b/MMVII/include/MMVII_MeasuresIm.h index 48993b3b4d..c0276b8738 100755 --- a/MMVII/include/MMVII_MeasuresIm.h +++ b/MMVII/include/MMVII_MeasuresIm.h @@ -189,6 +189,8 @@ class cSetMesGCP : public cMemCheck const std::vector & Measures() const; ///< Accessor static const std::string ThePrefixFiles; + std::list ListOfNames() const; + private : std::string mNameSet; std::vector mMeasures; @@ -258,6 +260,7 @@ class cSetMesImGCP : public cMemCheck cMes1GCP & MesGCPOfName(const std::string &) ; const cMes1GCP & MesGCPOfNum(int) const; const cMes1GCP & MesGCPOfMulIm(const cMultipleImPt &) const; + cSetMesGCP AllMesGCP() const; bool NameIsGCP(const std::string &) const; cSetMesGCP ExtractSetGCP(const std::string & aNameSet) const; diff --git a/MMVII/include/MMVII_Sensor.h b/MMVII/include/MMVII_Sensor.h index 9e480868ce..22e744ff78 100755 --- a/MMVII/include/MMVII_Sensor.h +++ b/MMVII/include/MMVII_Sensor.h @@ -573,6 +573,8 @@ class cPhotogrammetricProject void LoadIm(cSetMesImGCP&,cSensorImage & ) const; void SaveGCP(const cSetMesGCP&) const; + cSetMesGCP LoadGCPFromFolder(const std::string &) const; + cSetMesGCP LoadGCP() const; /// Name of the file, usefull if we need to test existence before doing anything std::string NameMeasureGCPIm(const std::string & aNameIm,bool isIn) const; @@ -712,8 +714,8 @@ class cPhotogrammetricProject /// Standard name for file of measures clino std::string NameFileMeasuresClino(bool Input,const std::string & aNameFile="" ) const; void SaveMeasureClino(const cSetMeasureClino &) const; - void ReadMeasureClino(cSetMeasureClino &) const; - cSetMeasureClino ReadMeasureClino() const; + void ReadMeasureClino(cSetMeasureClino &,const std::string * aPatSel=nullptr) const; + cSetMeasureClino ReadMeasureClino(const std::string * aPatSel=nullptr) const; //=================================================================== //================== Rigid Bloc ========================= diff --git a/MMVII/src/Appli/cMMVII_Appli.cpp b/MMVII/src/Appli/cMMVII_Appli.cpp index 04ca1f418d..f501ebb839 100755 --- a/MMVII/src/Appli/cMMVII_Appli.cpp +++ b/MMVII/src/Appli/cMMVII_Appli.cpp @@ -1152,7 +1152,6 @@ void cMMVII_Appli::LogCommandOut(const std::string & aName,bool MainLogFile) // Add id, if several process were throw in // there is a mix and we no longer know which was closed aOfs.Ofs() << " ending correctly at : " << StrDateCur() << " Time=" << SecFromT0() - TimeSegm().CurBeginTime() - << " TTT=" << SecFromT0() << " (Id=" << mPrefixNameAppli << ")\n\n"; aOfs.Ofs().close(); } diff --git a/MMVII/src/BundleAdjustment/Bundle_Clino.cpp b/MMVII/src/BundleAdjustment/Bundle_Clino.cpp index e8cdcc3c01..d94568e86b 100644 --- a/MMVII/src/BundleAdjustment/Bundle_Clino.cpp +++ b/MMVII/src/BundleAdjustment/Bundle_Clino.cpp @@ -422,4 +422,4 @@ namespace MMVII return aVRotR; } -} \ No newline at end of file +} diff --git a/MMVII/src/CodedTarget/CodedTarget.h b/MMVII/src/CodedTarget/CodedTarget.h index 9dda06a812..6a088326f5 100755 --- a/MMVII/src/CodedTarget/CodedTarget.h +++ b/MMVII/src/CodedTarget/CodedTarget.h @@ -262,8 +262,9 @@ class cParamCodedTarget : public cMemCheck /// fix number of pixel 4 draw void SetNbPixBin(int aNbPixBin); - /// Set default value that depend from the type , used only in create target - void FinishInitOfSpec(const cSpecBitEncoding & aSpec); + /** Set default value that depend from the type , used only in create target, + createInit : in mode read we dont do def init (would overwrite user's modif) */ + void FinishInitOfSpec(const cSpecBitEncoding & aSpec,bool createInit); int NbCodeAvalaible() const; // Number of different code we can generate @@ -449,6 +450,8 @@ class cFullSpecifTarget : public cMemCheck cParamRenderingTarget mRender; std::vector mBitsCenters; }; +void AddData(const cAuxAr2007 & anAux,cFullSpecifTarget & aSpecif); + /** Helper class for computing an encoding from the colours affected to different bits */ class cDecodeFromCoulBits diff --git a/MMVII/src/CodedTarget/cCircTargetExtract.cpp b/MMVII/src/CodedTarget/cCircTargetExtract.cpp index d54b3a02c7..cfbd46e53c 100755 --- a/MMVII/src/CodedTarget/cCircTargetExtract.cpp +++ b/MMVII/src/CodedTarget/cCircTargetExtract.cpp @@ -742,6 +742,7 @@ class cAppliExtractCircTarget : public cMMVII_Appli, int mZoomVisuLabel; int mZoomVisuSeed; int mZoomVisuElFinal; + bool mShowOnlyMul; cExtract_BW_Ellipse * mExtrEll; cParamBWTarget mPBWT; @@ -790,6 +791,7 @@ cAppliExtractCircTarget::cAppliExtractCircTarget mZoomVisuLabel (0), mZoomVisuSeed (0), mZoomVisuElFinal (0), + mShowOnlyMul (false), mExtrEll (nullptr), mImMarq (cPt2di(1,1)), mPhProj (*this), @@ -827,6 +829,7 @@ cCollecSpecArg2007 & cAppliExtractCircTarget::ArgOpt(cCollecSpecArg2007 & anArgO << AOpt2007(mZoomVisuLabel,"ZoomVisuLabel","Make a visualisation of labeled image",{eTA2007::HDV}) << AOpt2007(mZoomVisuSeed,"ZoomVisuSeed","Make a visualisation of seed point",{eTA2007::HDV}) << AOpt2007(mZoomVisuElFinal,"ZoomVisuEllipse","Make a visualisation extracted ellispe & target",{eTA2007::HDV}) + << AOpt2007(mShowOnlyMul,"ShowOnlyMul","Show Only Mutlipe detectection",{eTA2007::HDV}) << AOpt2007(mPatHihlight,"PatHL","Pattern for highliting targets in visu",{eTA2007::HDV}) << AOpt2007(mNbMaxMT_Init,"NbMMT0","Nb max of multiple target acceptable initial (for 0 image)",{eTA2007::HDV}) @@ -894,13 +897,16 @@ void cAppliExtractCircTarget::MakeImageFinalEllispe() cPt2dr aSz(50,50); cPt3dr aAlpha(0.7,0.7,0.7); + // In the case of simulation we know the ground truch if (mUseSimul) { + // show the missed target for (const auto & aGT : mGTMissed) { if (aGT->mResExtr ==nullptr) aImVisu.FillRectangle(cRGBImage::Red,ToI(aGT->mC-aSz),ToI(aGT->mC+aSz),aAlpha); } + // show the wrong detection for (const auto & anEE : mVCTE) { if ((anEE->mWithCode) && (anEE->mGT ==nullptr)) @@ -912,28 +918,32 @@ void cAppliExtractCircTarget::MakeImageFinalEllispe() for (const auto & anEE : mVCTE) { - const cEllipse & anEl = anEE->mEllipse; - bool doHL = MatchRegex(anEE->mEncode.Name(),mPatHihlight); - for (tREAL8 aMul = 1.0; aMul < (doHL ? 4.0 : 2.5); aMul += (doHL ? 0.05 : 0.4)) - { - aImVisu.DrawEllipse - ( - (anEE->mCardDetect==1) ? cRGBImage::Green : cRGBImage::Red , // anEE.mWithCode ? cRGBImage::Blue : cRGBImage::Red, - anEl.Center(), - anEl.LGa()*aMul , anEl.LSa()*aMul , anEl.TetaGa() - ); - } + if ((!mShowOnlyMul) || (anEE->mCardDetect!=1)) + { + const cEllipse & anEl = anEE->mEllipse; + bool doHL = MatchRegex(anEE->mEncode.Name(),mPatHihlight); + for (tREAL8 aMul = 1.0; aMul < (doHL ? 4.0 : 2.5); aMul += (doHL ? 0.05 : 0.4)) + { + aImVisu.DrawEllipse + ( + (anEE->mCardDetect==1) ? cRGBImage::Green : cRGBImage::Red , + anEl.Center(), + anEl.LGa()*aMul , anEl.LSa()*aMul , anEl.TetaGa() + ); + + } //BF - if (anEE->mWithCode) - { - aImVisu.DrawString - ( + if (anEE->mWithCode) + { + aImVisu.DrawString + ( anEE->mEncode.Name(),cRGBImage::Red, anEl.Center(),cPt2dr(0.5,0.5), 3 - ); + ); - } + } + } } aImVisu.ToJpgFileDeZoom(mPhProj.DirVisuAppli()+mPrefixOut + "_Ellipses.tif",mZoomVisuElFinal); diff --git a/MMVII/src/CodedTarget/cGenerateEncoding.cpp b/MMVII/src/CodedTarget/cGenerateEncoding.cpp index 25c447c40f..946efc811b 100755 --- a/MMVII/src/CodedTarget/cGenerateEncoding.cpp +++ b/MMVII/src/CodedTarget/cGenerateEncoding.cpp @@ -5,6 +5,8 @@ #include "CodedTarget.h" #include "MMVII_Stringifier.h" #include "MMVII_MeasuresIm.h" +#include "MMVII_Sensor.h" + namespace MMVII { @@ -215,6 +217,8 @@ class cAppliGenerateEncoding : public cMMVII_Appli cCollecSpecArg2007 & ArgOpt(cCollecSpecArg2007 & anArgOpt) override ; cPrioCC * GetBest(); + cPhotogrammetricProject mPhProj; + // tREAL8 ScoreOfCodeAndDist(,int aHamingDist); @@ -241,6 +245,7 @@ cAppliGenerateEncoding::cAppliGenerateEncoding const cSpecMMVII_Appli & aSpec ) : cMMVII_Appli (aVArgs,aSpec), + mPhProj (*this), mMiror (false), mCEC (nullptr) { @@ -271,6 +276,7 @@ cCollecSpecArg2007 & cAppliGenerateEncoding::ArgOpt(cCollecSpecArg2007 & anArgOp << AOpt2007(mSpec.mPrefix,"Prefix","Prefix for output files") << AOpt2007(mMiror,"Mir","Unify mirro codes") << AOpt2007(mNameOut,"Out","Name for output file") + << mPhProj.DPPointsMeasures().ArgDirInOpt("GCPNames","Dir GCP for code selection on names") ; } @@ -320,6 +326,7 @@ void MakeFile3DCern3DTargt(size_t aNBB,size_t aNbD) int cAppliGenerateEncoding::Exe() { + mPhProj.FinishInit(); int Num000 = 0; // [0] ======== Finish initialization and checking ================== @@ -438,6 +445,27 @@ int cAppliGenerateEncoding::Exe() } } + + if (mPhProj.DPPointsMeasures().DirInIsInit()) + { + cSetMesGCP aSetGCP = mPhProj.LoadGCP(); + std::set aLInt; + for (const auto & aGCP : aSetGCP.Measures()) + aLInt.insert(cStrIO::FromStr(aGCP.mNamePt)); + // StdOut() << "VOOOCSIZE= " << mVOC.size() << " " << aSetGCP.Measures().size() << "\n"; + erase_if + ( + mVOC, + [aLInt] (const auto & aPtr) {return ! MapBoolFind(aLInt,aPtr->mNum);} + ); + // StdOut() << "VOOOCSIZE= " << mVOC.size() << " " << aSetGCP.Measures().size() << "\n"; + // getchar(); + // std::vector mVOC; + + // StdOut() << "VOOOCSIZE= " << mVOC.size() << "\n"; + // StdOut() << " * N0=" << mVOC.at(0)->mNum << "\n"; + // StdOut() << " * N1=" << mVOC.at(1)->mNum << "\n"; + } // [3.0] if we use hamming code, not all numbers are possible if (mSpec.mUseHammingCode) diff --git a/MMVII/src/CodedTarget/cGenerateTarget.cpp b/MMVII/src/CodedTarget/cGenerateTarget.cpp index 18bc9c8b9b..5542455bc5 100755 --- a/MMVII/src/CodedTarget/cGenerateTarget.cpp +++ b/MMVII/src/CodedTarget/cGenerateTarget.cpp @@ -171,10 +171,11 @@ void cParamCodedTarget::PCT_AddData(const cAuxAr2007 & anAuxParam,const cSpecBit // MMVII::AddData(cAuxAr2007("SzHalfStr",anAux),mSzHalfStr); + if (anAux.Input()) { - MMVII_INTERNAL_ASSERT_strong(aSpec!=nullptr," cParamCodedTarget::PCT_AddData no Spec in input mode"); - FinishInitOfSpec(*aSpec); + MMVII_INTERNAL_ASSERT_strong(aSpec!=nullptr," cParamCodedTarget::PCT_AddData no Spec in input mode"); + FinishInitOfSpec(*aSpec,false); FinishWoSpec(); } } @@ -236,7 +237,7 @@ cParamCodedTarget::cParamCodedTarget(int aNbPixBin) : SetNbPixBin(aNbPixBin); } -void cParamCodedTarget::FinishInitOfSpec(const cSpecBitEncoding & aSpec) +void cParamCodedTarget::FinishInitOfSpec(const cSpecBitEncoding & aSpec,bool createInit) { mType = aSpec.mType; cMMVII_Appli & anAppli = cMMVII_Appli::CurrentAppli(); @@ -244,38 +245,43 @@ void cParamCodedTarget::FinishInitOfSpec(const cSpecBitEncoding & aSpec) mNbBit = aSpec.mNbBits; mWithParity = aSpec.mParity; - if (aSpec.mType==eTyCodeTarget::eIGNIndoor) - { - // Nothingto do all default value have been setled for this case - } - else if ((aSpec.mType==eTyCodeTarget::eIGNDroneSym) || (aSpec.mType==eTyCodeTarget::eIGNDroneTop)) - { - anAppli.SetIfNotInit(mModeFlight,true); - anAppli.SetIfNotInit(mCBAtTop,(aSpec.mType==eTyCodeTarget::eIGNDroneTop)); - anAppli.SetIfNotInit(mThickN_WInt,0.05); - anAppli.SetIfNotInit(mThickN_Code,0.0); - anAppli.SetIfNotInit(mThickN_WExt,0.0); - anAppli.SetIfNotInit(mThickN_Car,0.3); - anAppli.SetIfNotInit(mChessboardAng,-M_PI/4.0); - anAppli.SetIfNotInit(mThickN_BorderExt,0.05); - - anAppli.SetIfNotInit(mRadiusOrientTablet,0.1); - anAppli.SetIfNotInit(mCenterOrientTablet,cPt2dr(0.7,0)); - } - else if (aSpec.mType==eTyCodeTarget::eCERN) + // if we are not in initial creation (i.e we reading existing file) all these modif that are related + // to the fact that user did or didnt specify are meaningless, value read must not be changed + if (createInit) { - // anAppli.SetIfNotInit(mNbBit,20); - // anAppli.SetIfNotInit(mWithParity,false); - - anAppli.SetIfNotInit(mNbRedond,1); - anAppli.SetIfNotInit(mThickN_WInt,(mNbBit==20) ? 1.5 : 1.0); - anAppli.SetIfNotInit(mThickN_Code,(mNbBit==20) ? 1.5 : 1.0); - anAppli.SetIfNotInit(mThickN_WExt,0.9); - anAppli.SetIfNotInit(mThickN_BorderExt,0.10); - - anAppli.SetIfNotInit(mWithChessboard,false); - anAppli.SetIfNotInit(mWhiteBackGround,false); - anAppli.SetIfNotInit(mAntiClockWiseBit,false); + if (aSpec.mType==eTyCodeTarget::eIGNIndoor) + { + // Nothingto do all default value have been setled for this case + } + else if ((aSpec.mType==eTyCodeTarget::eIGNDroneSym) || (aSpec.mType==eTyCodeTarget::eIGNDroneTop)) + { + anAppli.SetIfNotInit(mModeFlight,true); + anAppli.SetIfNotInit(mCBAtTop,(aSpec.mType==eTyCodeTarget::eIGNDroneTop)); + anAppli.SetIfNotInit(mThickN_WInt,0.05); + anAppli.SetIfNotInit(mThickN_Code,0.0); + anAppli.SetIfNotInit(mThickN_WExt,0.0); + anAppli.SetIfNotInit(mThickN_Car,0.3); + anAppli.SetIfNotInit(mChessboardAng,-M_PI/4.0); + anAppli.SetIfNotInit(mThickN_BorderExt,0.05); + + anAppli.SetIfNotInit(mRadiusOrientTablet,0.1); + anAppli.SetIfNotInit(mCenterOrientTablet,cPt2dr(0.7,0)); + } + else if (aSpec.mType==eTyCodeTarget::eCERN) + { + // anAppli.SetIfNotInit(mNbBit,20); + // anAppli.SetIfNotInit(mWithParity,false); + + anAppli.SetIfNotInit(mNbRedond,1); + anAppli.SetIfNotInit(mThickN_WInt,(mNbBit==20) ? 1.5 : 1.0); + anAppli.SetIfNotInit(mThickN_Code,(mNbBit==20) ? 1.5 : 1.0); + anAppli.SetIfNotInit(mThickN_WExt,0.9); + anAppli.SetIfNotInit(mThickN_BorderExt,0.10); + + anAppli.SetIfNotInit(mWithChessboard,false); + anAppli.SetIfNotInit(mWhiteBackGround,false); + anAppli.SetIfNotInit(mAntiClockWiseBit,false); + } } mSzHalfStr = (aSpec.mNbDigit+1)/2; @@ -1052,6 +1058,7 @@ cFullSpecifTarget * cFullSpecifTarget::CreateFromFile(const std::string & aName cFullSpecifTarget * aRes = new cFullSpecifTarget; ReadFromFile(*aRes,aName); + if (0) // we dont reset nb of bit, because don want do generate comments as 100100111 { for (auto & anEncod : aRes->mBE.Encodings()) @@ -1125,6 +1132,7 @@ class cAppliGenCodedTarget : public cMMVII_Appli cParamCodedTarget mPCT; bool mDoMarkC; std::string mPatternDoImage; + std::string mPrefixVisu; int mNbPixBin; std::string mNameOut; bool mIm4Test; ///< Do we generate image for inspection (and not for printing) @@ -1138,6 +1146,7 @@ cAppliGenCodedTarget::cAppliGenCodedTarget(const std::vector & aVAr mPhgrPr (*this), mPerGen (10), mDoMarkC (false), + mPrefixVisu (""), mNbPixBin (1800), mIm4Test (false) { @@ -1158,6 +1167,7 @@ cCollecSpecArg2007 & cAppliGenCodedTarget::ArgOpt(cCollecSpecArg2007 & anArgOpt) { return anArgOpt << AOpt2007(mPatternDoImage,"PatIm","Pattern for generating image (def no generation)") + << AOpt2007(mPrefixVisu,"PrefixVisu","To add in image name when PatIm is used",{eTA2007::HDV}) << AOpt2007(mIm4Test,"I4T","Generate image for test/inspection, not for use",{eTA2007::HDV}) << AOpt2007(mPCT.mRadiusCenterMiniTarget,"RayMCT","Rayon \"mini\" center target (for topo)",{eTA2007::HDV}) // << AOpt2007(mPCT.mNbBit,"NbBit","Nb Bit printed",{eTA2007::HDV}) @@ -1190,19 +1200,19 @@ int cAppliGenCodedTarget::Exe() mPCT.SetNbPixBin(mNbPixBin); ReadFromFile(mBE,mNameBE); - mPCT.FinishInitOfSpec(mBE.Specs()); + mPCT.FinishInitOfSpec(mBE.Specs(),true); mPCT.FinishWoSpec(); cFullSpecifTarget aFullSpec(mBE,mPCT); // Activate the computaion of centers aFullSpec.ImagePattern(); - std::string aDirVisu = mPhgrPr.DirVisu(); + std::string aDirVisu = mPhgrPr.DirVisuAppli(); if (IsInit(&mPatternDoImage)) { // generate the pattern image - aFullSpec.ImagePattern().DIm().ToFile(aDirVisu+aFullSpec.NameOfImPattern()); + aFullSpec.ImagePattern().DIm().ToFile(aDirVisu+mPrefixVisu + aFullSpec.NameOfImPattern()); // parse all encodings for (const auto & anEncode : aFullSpec.Encodings()) @@ -1212,7 +1222,7 @@ int cAppliGenCodedTarget::Exe() cCodedTargetPatternIm::tIm anIm = aFullSpec.OneImTarget(anEncode,mIm4Test); std::string aName = aFullSpec.NameOfEncode(anEncode); - anIm.DIm().ToFile(aDirVisu+aName); + anIm.DIm().ToFile(aDirVisu+mPrefixVisu +aName); StdOut() << aName << std::endl; } } diff --git a/MMVII/src/CodedTarget/cSimulTarget.cpp b/MMVII/src/CodedTarget/cSimulTarget.cpp index cb5c363929..5e6a5ae9ae 100755 --- a/MMVII/src/CodedTarget/cSimulTarget.cpp +++ b/MMVII/src/CodedTarget/cSimulTarget.cpp @@ -236,6 +236,14 @@ void cAppliSimulCodeTarget::IncrustTarget(cGeomSimDCT & aGSD) // [1] -- Load and scale image of target tIm aImT = Convert((tElem*)nullptr,mSpec->OneImTarget(aGSD.mEncod).DIm()); + +/* + static bool isFirst = false; + if (isFirst && mShowFirst) + { + isFirst = true; + } +*/ aImT = aImT.GaussDeZoom(mDownScale,5); @@ -367,6 +375,7 @@ int cAppliSimulCodeTarget::Exe() // mPCT.InitFromFile(mNameSpecif); mSpec = cFullSpecifTarget::CreateFromFile(mNameSpecif); + mImIn = tIm::FromFile(mNameIm); for (const auto & anEncod : mSpec->Encodings()) diff --git a/MMVII/src/ImportFormat/CERN_ImportClino.cpp b/MMVII/src/ImportFormat/CERN_ImportClino.cpp index f444d18d73..c3436ba76e 100644 --- a/MMVII/src/ImportFormat/CERN_ImportClino.cpp +++ b/MMVII/src/ImportFormat/CERN_ImportClino.cpp @@ -38,12 +38,16 @@ class cAppli_CERN_ImportClino : public cMMVII_Appli std::vector Samples() const override; std::vector mNamesClino; + std::string mNameFile; + std::string mPatIm; }; cAppli_CERN_ImportClino::cAppli_CERN_ImportClino(const std::vector & aVArgs,const cSpecMMVII_Appli & aSpec) : cMMVII_Appli (aVArgs,aSpec), mPhProj (*this), - mNamesClino {"A1","B1","B2","A2"} + mNamesClino {"A1","B1","B2","A2"}, + mNameFile ("ClinoValue.json"), + mPatIm ("043.*") { } @@ -59,7 +63,9 @@ cCollecSpecArg2007 & cAppli_CERN_ImportClino::ArgOpt(cCollecSpecArg2007 & anArgF { return anArgFac - << AOpt2007(mNamesClino,"NameClino","Name of Clino") + << AOpt2007(mNamesClino,"NameClino","Name of Clino",{eTA2007::HDV}) + << AOpt2007(mNameFile,"NameFile","Name of file in each folder",{eTA2007::HDV}) + << AOpt2007(mPatIm,"PatIm","Pattern for extracting image from folder",{eTA2007::HDV}) // << AOpt2007(mNbDigName,"NbDigName","Number of digit for name, if fixed size required (only if int)") // << AOpt2007(mL0,"NumL0","Num of first line to read",{eTA2007::HDV}) // << AOpt2007(mLLast,"NumLast","Num of last line to read (-1 if at end of file)",{eTA2007::HDV}) @@ -72,10 +78,10 @@ cCollecSpecArg2007 & cAppli_CERN_ImportClino::ArgOpt(cCollecSpecArg2007 & anArgF void cAppli_CERN_ImportClino::MakeOneDir(const std::string & aDir,cMMVII_Ofs & anOFS) const { - std::string aNameF = aDir + StringDirSeparator() + "ClinoValue.json"; + std::string aNameF = aDir + StringDirSeparator() + mNameFile; std::ifstream infile(aNameF); - std::vector aVFileIm = GetFilesFromDir(aDir+StringDirSeparator(),AllocRegex("043.*")); + std::vector aVFileIm = GetFilesFromDir(aDir+StringDirSeparator(),AllocRegex(mPatIm)); MMVII_INTERNAL_ASSERT_tiny(aVFileIm.size()==1,"cAppli_CERN_ImportClino : bad size for image pattern match"); anOFS.Ofs() << aVFileIm.at(0) ; @@ -135,7 +141,7 @@ int cAppli_CERN_ImportClino::Exe() std::vector cAppli_CERN_ImportClino::Samples() const { - return {"MMVII V2ImportCalib ../../Pannel/ BA_725 CalibInit725"}; + return {"MMVII CERN_ImportClino ./ MMC.txt PatIm=\"043.*\" NameClino=[A,B,C,D] NameFile=ClinoValue.json"}; } diff --git a/MMVII/src/ImportFormat/ImportClino.cpp b/MMVII/src/ImportFormat/ImportClino.cpp index 465ff97214..19ab23fda3 100644 --- a/MMVII/src/ImportFormat/ImportClino.cpp +++ b/MMVII/src/ImportFormat/ImportClino.cpp @@ -87,6 +87,13 @@ std::string cSetMeasureClino::NameOfIm(const cOneMesureClino & aMes) const return ReplacePattern(mPatMatch,mPatReplace,aMes.Ident()); } +void cSetMeasureClino::FilterByPatIdent(const std::string & aPat) +{ + erase_if(mSetMeasures,[aPat](const cOneMesureClino &aMes){return ! MatchRegex(aMes.Ident(),aPat);}); +} + + + /* **************************************************************** */ /* */ /* cOneMesureClino */ diff --git a/MMVII/src/Instrumental/cClinoInit.cpp b/MMVII/src/Instrumental/cClinoInit.cpp index 86c5b5bf8d..8fbcb36ebd 100644 --- a/MMVII/src/Instrumental/cClinoInit.cpp +++ b/MMVII/src/Instrumental/cClinoInit.cpp @@ -258,6 +258,7 @@ class cAppli_ClinoInit : public cMMVII_Appli std::vector mOriRelClin; ///< vector of relative orientations Clino[0]/Clino[K] bool mShowAll; ///< Do we show all the msg relative to residuals cCalibSetClino mCalibSetClino; ///< Result of the calibration + std::string mPatFilter; }; cAppli_ClinoInit::cAppli_ClinoInit @@ -272,7 +273,8 @@ cAppli_ClinoInit::cAppli_ClinoInit mNbIter (50), mNameRel12 ("i-kj"), isOkNoCam (false), - mShowAll (false) + mShowAll (false), + mPatFilter (".*") { } @@ -298,6 +300,7 @@ cCollecSpecArg2007 & cAppli_ClinoInit::ArgOpt(cCollecSpecArg2007 & anArgOpt) << AOpt2007(mNameRel12,"Rel12","orientation relative 2 to 1, if several clino",{eTA2007::HDV}) << AOpt2007(isOkNoCam,"OkNoCam","is it OK if some cam dont exist",{eTA2007::HDV}) << mPhProj.DPClinoMeters().ArgDirInOpt() // Just for temporart test we can re-read, to supress later + << AOpt2007(mPatFilter,"PatFilter","Pattern for filtering measure on ident",{eTA2007::HDV}) ; } @@ -418,8 +421,9 @@ int cAppli_ClinoInit::Exe() // --------- Read formated file ---------------- - cSetMeasureClino aSMC = mPhProj.ReadMeasureClino() ; - const std::vector& aVMC = aSMC.SetMeasures(); + cSetMeasureClino aSMC = mPhProj.ReadMeasureClino(&mPatFilter) ; + // const std::vector& aVMC = aSMC.SetMeasures(); + std::vector aVMC = aSMC.SetMeasures(); // ------------- Compute vector ofrelative position : usefull only when we have 2 clino tRotR aRSim = tRotR::Identity(); // Rotation for simulation @@ -491,6 +495,7 @@ int cAppli_ClinoInit::Exe() tREAL8 aStep = 2.0/mNbStep0; tREAL8 aDiv = 1.25; + tREAL8 aInitRes = std::sqrt(aWM0.ValExtre()); for (int aK=0 ; aK tPairCamPt; void cAppli_ReportBlock::TestPoint3D(const std::string & anIdSync,const std::vector & aVCam) { std::map> aMapMatch; + cWeightAv aAvgRes; for (const auto & aCam : aVCam) { @@ -216,12 +220,17 @@ void cAppli_ReportBlock::TestPoint3D(const std::string & anIdSync,const std::vec } tREAL8 aDistPix = aWPix.Average() * (aNbPt*2.0) / (aNbPt*2.0 -3.0); AddOneReportCSV(mRepPt,{anIdSync,ToStr(aNbPt),ToStr(aDistPix)}); + aAvgRes.Add(aNbPt,aDistPix); } } - + + AddOneReportCSV(mRepPt,{"AVG "+anIdSync,ToStr(aAvgRes.SW()),ToStr(aAvgRes.Average())}); + + mAvgGlobRes.Add(aAvgRes.SW(),aAvgRes.Average()); } + void cAppli_ReportBlock::MakeOneBloc(const std::vector & aVCam) { std::string anIdSync = mTheBloc->IdSync(aVCam.at(0)->NameImage()); @@ -238,6 +247,8 @@ int cAppli_ReportBlock::Exe() std::string aDirRep = mPhProj.DPOrient().DirIn() + "-" + mPhProj.DPPointsMeasures().DirIn() + "-" + mPhProj.DPRigBloc().DirIn() ; + if (IsInit(&mAddExReport)) + aDirRep = mAddExReport + "-" + aDirRep; SetReportSubDir(aDirRep); @@ -258,6 +269,7 @@ int cAppli_ReportBlock::Exe() MakeOneBloc(aVC); DeleteAllAndClear(aVC); } + AddOneReportCSV(mRepPt,{"AVG Glob",ToStr(mAvgGlobRes.SW()),ToStr(mAvgGlobRes.Average())}); DeleteAllAndClear(mListBloc); return EXIT_SUCCESS; diff --git a/MMVII/src/Sensors/Measures.cpp b/MMVII/src/Sensors/Measures.cpp index 180e2004e6..bb81cf3e53 100644 --- a/MMVII/src/Sensors/Measures.cpp +++ b/MMVII/src/Sensors/Measures.cpp @@ -209,6 +209,15 @@ cMes1GCP & cSetMesImGCP::MesGCPOfName(const std::string & aNamePt) } +cSetMesGCP cSetMesImGCP::AllMesGCP() const +{ + cSetMesGCP aRes; + for (const auto & aGCP : mMesGCP) + aRes.AddMeasure(aGCP); + + return aRes; +} + const cMes1GCP & cSetMesImGCP::MesGCPOfNum(int aNum) const @@ -656,6 +665,15 @@ cSetMesGCP::cSetMesGCP() : { } +std::list cSetMesGCP::ListOfNames() const +{ + std::list aRes; + for (const auto & aGCP : mMeasures) + aRes.push_back(aGCP.mNamePt); + + return aRes; +} + void cSetMesGCP::ChangeCoord(const cDataMapping& aMapping) diff --git a/MMVII/src/Sensors/cPhotogrammetricProject.cpp b/MMVII/src/Sensors/cPhotogrammetricProject.cpp index 589a3e1b01..fec2d9a118 100644 --- a/MMVII/src/Sensors/cPhotogrammetricProject.cpp +++ b/MMVII/src/Sensors/cPhotogrammetricProject.cpp @@ -804,6 +804,17 @@ void cPhotogrammetricProject::LoadGCP(cSetMesImGCP& aSetMes,const std::string & } +cSetMesGCP cPhotogrammetricProject::LoadGCP() const +{ + cSetMesImGCP aSetMesIm; + LoadGCP(aSetMesIm); + return aSetMesIm.AllMesGCP(); +} +cSetMesGCP cPhotogrammetricProject::LoadGCPFromFolder(const std::string & aFolder) const +{ + cAutoChgRestoreDefFolder aCRDF(aFolder,DPPointsMeasures()); // Chg Folder and restore at destruction + return LoadGCP(); +} @@ -1145,15 +1156,19 @@ void cPhotogrammetricProject::SaveMeasureClino(const cSetMeasureClino & aSetM) c SaveInFile(const_cast(aSetM),NameFileMeasuresClino(false)); } -void cPhotogrammetricProject::ReadMeasureClino(cSetMeasureClino & aSet) const +void cPhotogrammetricProject::ReadMeasureClino(cSetMeasureClino & aSet,const std::string * aPat) const { ReadFromFile(aSet,NameFileMeasuresClino(true)); + if (aPat!=nullptr) + { + aSet.FilterByPatIdent(*aPat); + } } -cSetMeasureClino cPhotogrammetricProject::ReadMeasureClino() const +cSetMeasureClino cPhotogrammetricProject::ReadMeasureClino(const std::string * aPat) const { cSetMeasureClino aRes; - ReadMeasureClino(aRes); + ReadMeasureClino(aRes,aPat); return aRes; }