Skip to content

Commit

Permalink
Merge branch 'mpd'
Browse files Browse the repository at this point in the history
  • Loading branch information
deseilligny committed Apr 11, 2024
2 parents dd8fe5c + 3ba10cc commit f4fb2d0
Show file tree
Hide file tree
Showing 46 changed files with 1,242 additions and 197 deletions.
2 changes: 2 additions & 0 deletions MMVII/include/MMVII_Bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ void BenchGlobImage(cParamExeBench & aParam); ///< Global bench on image
void BenchFilterImage1(cParamExeBench & aParam);
void BenchFilterLinear(cParamExeBench & aParam);
void BenchGeom(cParamExeBench & aParam);
void BenchPlane3D();
void BenchPlaneInter();

void BenchMapping(cParamExeBench & aParam);
void BenchInvertMapping(cParamExeBench & aParam);
Expand Down
1 change: 1 addition & 0 deletions MMVII/include/MMVII_DeclareAllCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ extern cSpecMMVII_Appli TheSpec_TutoSerial;
extern cSpecMMVII_Appli TheSpec_TutoFormalDeriv;
extern cSpecMMVII_Appli TheSpec_ExportUndistMesIm;
extern cSpecMMVII_Appli TheSpecAppliExtractLine;
extern cSpecMMVII_Appli TheSpec_CERN_ImportClino;
};

#endif // _MMVII_DeclareAllCmd_H_
1 change: 1 addition & 0 deletions MMVII/include/MMVII_Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace MMVII


// extern int The_MMVII_DebugLevel = The_MMVII_DebugLevel_InternalError_medium;
// #define The_MMVII_DebugLevel The_MMVII_DebugLevel_BenchError
#define The_MMVII_DebugLevel The_MMVII_DebugLevel_InternalError_tiny
// #define The_MMVII_DebugLevel The_MMVII_DebugLevel_BenchError
// #define The_MMVII_DebugLevel The_MMVII_DebugLevel_UserError
Expand Down
18 changes: 16 additions & 2 deletions MMVII/include/MMVII_ExtractLines.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ class cHoughTransform;
template <class Type> class cImGradWithN;
template <class Type> class cExtractLines;

enum class eCodeHPS
{
Ok,
LowCumul,
NotFirst
};

class cHoughPS : public cMemCheck
{
Expand All @@ -21,13 +27,16 @@ class cHoughPS : public cMemCheck
tREAL8 DistAnglAntiPar(const cHoughPS& aPS2) const;
tREAL8 DY(const cHoughPS&) const;
tREAL8 Dist(const cHoughPS&,const tREAL8 &aFactTeta=1.0) const;
tSeg2dr SegMoyAntiParal(const cHoughPS& aPS2) const;

const cPt2dr & TetaRho() const; ///< Accessor
const tREAL8 & Teta() const; ///< Accessor
const tREAL8 & Rho() const; ///< Accessor
const tSeg & Seg() const ; ///< Accessor
cHoughPS * Matched() const; ///< Accessor
const tREAL8 & Cumul() const; ///< Accessor
const tREAL8 & Cumul() const; ///< Accessor
eCodeHPS Code() const ; ///< Accessor
void SetCode(eCodeHPS); ///< Modifior

cPt2dr IndTetaRho() const; ///< Teta/Rho in hough accum dynamic

Expand All @@ -48,6 +57,8 @@ class cHoughPS : public cMemCheck
tSeg mSegE;
cHoughPS * mMatched;
tREAL8 mDistM;

eCodeHPS mCode;
};


Expand Down Expand Up @@ -91,9 +102,12 @@ class cHoughTransform
tREAL8 aThrMax // threshold on Max, select if Accum > Max * Avg
) const;

/// max the conversion houg-point -> euclidian line + rho teta
/// max the conversion houg-point + value -> euclidian line + rho teta
cHoughPS * PtToLine(const cPt3dr &) const;

/// make the conversion seg (oriented) -> hough point
cPt2dr Line2Pt(const tSeg2dr &) const;

const tREAL8 & RhoMax() const; ///< Accessor
/// return the angle teta, of a given index/position in hough accumulator
inline tREAL8 RInd2Teta(tREAL8 aIndTeta) const {return aIndTeta *mFactI2T;}
Expand Down
3 changes: 3 additions & 0 deletions MMVII/include/MMVII_Geom2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace MMVII
{

typedef cSegment<tREAL8,2> tSeg2dr;


/** \file MMVII_Geom2D.h
\brief contain classes for geometric manipulation, specific to 2D space :
Expand Down Expand Up @@ -84,6 +86,7 @@ template <class Type> class cSegment2DCompiled : public cSegmentCompiled<Type,2>
public :
typedef cPtxd<Type,2> tPt;
cSegment2DCompiled(const tPt& aP1,const tPt& aP2);
cSegment2DCompiled(const cSegment<Type,2>&);
tPt ToCoordLoc(const tPt&) const;
tPt FromCoordLoc(const tPt&) const;
Type DistLine(const tPt&) const; ///< distance between the line and the point
Expand Down
24 changes: 20 additions & 4 deletions MMVII/include/MMVII_Geom3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,20 @@ template <class Type> class cTriangulation3D : public cTriangulation<Type,3>
class cPlane3D
{
public :
/* --------------------- Static constructor ---------------------------*/
/// construct with 1 point inside, and 2 vector inside
static cPlane3D FromP0And2V(const cPt3dr & aP0,const cPt3dr& aAxeI , const cPt3dr& aAxeJ);
/// construct with 1 point inside, and the normal direction
static cPlane3D FromPtAndNormal(const cPt3dr & aP0,const cPt3dr& aAxeK);
/// construct with 3 point inside
static cPlane3D From3Point(const cPt3dr & aP0, const cPt3dr & aP1, const cPt3dr &aP2);

/// Estimate from a set of point,
static std::pair<cPlane3D,tREAL8> RansacEstimate(const std::vector<cPt3dr> & aP0,bool AvgOrMax,int aNbTest=-1,tREAL8 aRegulMinTri =1e-3);
/// Return the indexes of the "best" plane
static std::pair<cPt3di,tREAL8> IndexRansacEstimate(const std::vector<cPt3dr> & aP0,bool AvgOrMax,int aNbTest=-1,tREAL8 aRegulMinTri =1e-3);
static std::pair<cPlane3D,tREAL8> RansacEstimate(const std::vector<cPt3dr> & aP0,bool AvgOrMax,int aNbTest=-1,tREAL8 aRegulMinTri =1e-3);

/// Avegrage distance
tREAL8 AvgDist(const std::vector<cPt3dr> &) const;
tREAL8 MaxDist(const std::vector<cPt3dr> &) const;

Expand All @@ -344,10 +351,19 @@ class cPlane3D

// return 3 point for random plane
static std::vector<cPt3dr> RandParam();
const cPt3dr& AxeI() const;
const cPt3dr& AxeJ() const;
const cPt3dr& AxeK() const;

const cPt3dr& P0() const; ///< Accessor
const cPt3dr& AxeI() const; ///< Accessor
const cPt3dr& AxeJ() const; ///< Accessor
const cPt3dr& AxeK() const; ///< Accessor

/** Return the intersection of the planes consider as vector space , used eigen decomposition
* to get the best solutuob if Nb>2, if Sz=1 or 0 and aSzMin is Ok, return a random acceptable solution */
static cPt3dr DirInterPlane(const std::vector<const cPlane3D*>& aVPlanes,int aSzMin=2);
static cPt3dr DirInterPlane(const std::vector<cPlane3D>& aVPlanes,int aSzMin=2);

static tSeg3dr InterPlane(const std::vector<const cPlane3D*>& aVPlanes,int aSzMin=2,tREAL8 aWeithStab=1e-10);
static tSeg3dr InterPlane(const std::vector<cPlane3D>& aVPlanes,int aSzMin=2,tREAL8 aWeithStab=1e-10);
private :
cPlane3D(const cPt3dr & aP0,const cPt3dr& aAxeI , const cPt3dr& aAxeJ);
cPt3dr mP0;
Expand Down
4 changes: 2 additions & 2 deletions MMVII/include/MMVII_Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ template <class Type> class cResulSymEigenValue
// => mEigenVectors * cDenseMatrix<Type>::Diag(mEigenValues) * mEigenVectors.Transpose();


const cDenseVect<Type> & EigenValues() const ; ///< Eigen values
const cDenseVect<Type> & EigenValues() const ; ///< Eigen values, in growing order !!! != cResulSVDDecomp
const cDenseMatrix<Type> & EigenVectors()const ; ///< Eigen vector
void SetKthEigenValue(int aK,const Type & aVal) ; ///< Eigen values
Type Cond(Type Def=Type(-1)) const ; ///< Conditioning, def value is when all 0, if all0 and Def<0 : Error
Expand All @@ -571,7 +571,7 @@ template <class Type> class cResulSVDDecomp

cDenseMatrix<Type> OriMatr() const; ///< Check the avability to reconstruct original matrix

const cDenseVect<Type> & SingularValues() const ; ///< Eigen values
const cDenseVect<Type> & SingularValues() const ; ///< Eigen values, in decreasing order !!! != cResulSymEigenValue
const cDenseMatrix<Type> & MatU()const ; ///< Eigen vector
const cDenseMatrix<Type> & MatV()const ; ///< Eigen vector
// void SetKthEigenValue(int aK,const Type & aVal) ; ///< Eigen values
Expand Down
25 changes: 25 additions & 0 deletions MMVII/include/MMVII_MeasuresIm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "MMVII_Ptxd.h"
#include "MMVII_util_tpl.h"
#include "MMVII_Geom2D.h"

namespace MMVII
{
Expand Down Expand Up @@ -494,6 +495,30 @@ class cFilterMesIm

};

/** Represent one line anti paral (computed by matching of 2 oriented line anti paral) */

class cOneLineAntiParal
{
public :
cOneLineAntiParal();

tSeg2dr mSeg;
tREAL8 mAng;
tREAL8 mWidth;
tREAL8 mCumul;
};
void AddData(const cAuxAr2007 & anAux,cOneLineAntiParal & anEx);


class cLinesAntiParal1Im
{
public :
std::string mNameIm;
std::string mDirCalib;
std::vector<cOneLineAntiParal> mLines;
};
void AddData(const cAuxAr2007 & anAux,cLinesAntiParal1Im & anEx);



};
Expand Down
8 changes: 8 additions & 0 deletions MMVII/include/MMVII_PCSens.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ class cPerspCamIntrCalib : public cObj2DelAtEnd,
/// For inversion, or sampling point, we need seed that is +- corresponding of sensor midle, befor dist
cPt2dr PtSeedInv() const;

/// Let S be a seg in undist space, extend as much as possible while distorted is include in image
tSeg2dr ExtenSegUndistIncluded
(
const tSeg2dr & aSegInit,
tREAL8 aStepInitRel=0.05,
tREAL8 aStepEnd=1.0,
tREAL8 aRetract=0.0
) const;
private :
/// big object, no valuable copy
cPerspCamIntrCalib(const cPerspCamIntrCalib &) = delete;
Expand Down
2 changes: 2 additions & 0 deletions MMVII/include/MMVII_Ptxd.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ template <class Type,const int Dim> class cSegment
void CompileFoncLinear(Type & aVal,tPt & aVec,const Type &aV1,const Type & aV2) const;
const tPt& P1() const; ///< Accessor
const tPt& P2() const; ///< Accessor
tPt& P1() ; ///< Accessor
tPt& P2() ; ///< Accessor

tPt V12() const; ///< Vector P1->P2
tPt PMil() const; ///< P middle
Expand Down
9 changes: 9 additions & 0 deletions MMVII/include/MMVII_Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ class cPhotogrammetricProject
//===================================================================

void SaveMeasureIm(const cSetMesPtOf1Im & aSetM) const;
/// Does the measure exist
bool HasMeasureIm(const std::string & aNameIm,bool InDir=true) const;
/// return from Std Dir, can be out in case of reload
cSetMesPtOf1Im LoadMeasureIm(const std::string &,bool InDir=true) const;
void LoadGCP(cSetMesImGCP&,const std::string & aPatFiltrFile="",const std::string & aFiltrNameGCP="",
Expand Down Expand Up @@ -564,6 +566,13 @@ class cPhotogrammetricProject
cSet2D3D LoadSet32(const std::string & aNameIm) const;

void SaveAndFilterAttrEll(const cSetMesPtOf1Im & aSetM,const std::list<std::string> & ToRem) const ;


// --------------- Segment in/out ----------------------------------------
std::string NameFileLines(const std::string & aNameIm) const;
bool HasFileLines(const std::string & aNameIm) const;
void SaveLines(const cLinesAntiParal1Im &) const;
cLinesAntiParal1Im ReadLines(const std::string & aNameIm) const;

//===================================================================
//================== META-DATA ==============================
Expand Down
15 changes: 15 additions & 0 deletions MMVII/include/MMVII_Stringifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,21 @@ class cCmpSerializer
};
*/

static std::string CurFile; /// global var to get context, not proud of that
static int CurLine; /// global var to get context, not proud of that

template<class Type> inline Type GetV(std::istringstream & iss)
{
Type aNum;
iss >> aNum;
if ( iss.rdstate())
{
MMVII_UnclasseUsEr("Bad reading at line " + ToStr(CurLine) + " of file [" + CurFile + "] , rdstate=" + ToStr((size_t)iss.rdstate()));
}
return aNum;
}




};
Expand Down
1 change: 1 addition & 0 deletions MMVII/include/MMVII_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ enum class eTyUEr
eNoFocaleEqui35,
eNoNumberPixel,
eNoCameraName,
eMultipleTargetInOneImage,
eUnClassedError,
eNbVals
};
Expand Down
3 changes: 2 additions & 1 deletion MMVII/include/MMVII_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class cCarLookUpTable
void InitId(char aC1,char aC2);
void Chg1C(char aC1,char aC2);


void InitIdGlob();

inline char Val(const int & aV) const
{
Expand All @@ -67,6 +67,7 @@ class cCarLookUpTable
bool mReUsable; ///< If InitId of Chg1C used -> no longer reusable
};


// Indicate if all "word" of list are in KeyList, use aSpace to separate word
// Si aMes=="SVP"=> No Error just return false, else aMes is error message
bool CheckIntersect(const std::string & aMes,const std::string & aKeyList,const std::string & aList,const std::string & aSpace);
Expand Down
11 changes: 11 additions & 0 deletions MMVII/include/MMVII_util_tpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,17 @@ template <class tCont> typename tCont::value_type * KthElem(tCont & aCont,int
return nullptr;
}

template <class Type> std::vector<const Type*> VecObj2VecPtr(const std::vector<Type> & aVecObj)
{
std::vector<const Type *> aVPtr;

for (const auto & aObj : aVecObj)
aVPtr.push_back(&aObj);

return aVPtr;
}



/** Used in Metadata, but can be used more generally.
*
Expand Down
8 changes: 7 additions & 1 deletion MMVII/include/cMMVII_Appli.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ class cMMVII_Appli : public cMMVII_Ap_NameManip,
bool ModeHelp() const; ///< If we are in help mode, don't execute
bool ModeArgsSpec() const; ///< If called only to output args specs, don't execute
virtual ~cMMVII_Appli(); ///< Always virtual Dstrctr for "big" classes
void ToDoBeforeDestruction(); ///< Some stuff to do at the end, require virtual method that cannot be called in X::~X()
bool IsInit(const void *) const; ///< indicate for each variable if it was initiazed by argc/argv
bool IsInSpecObl(const void *); ///< indicate for each variable if it was in an arg opt list (used with cPhotogrammetricProject)
bool IsInSpecFac(const void *); ///< indicate for each variable if it was in an arg obl list (used with cPhotogrammetricProject)
Expand Down Expand Up @@ -531,10 +532,15 @@ class cMMVII_Appli : public cMMVII_Ap_NameManip,
std::string NameTmpReport(const std::string &anId,const std::string &anImg);
void SetReportSubDir(const std::string &);

void InitReport(const std::string &anId,const std::string & aPost,bool IsMul);
/// Mehod called when the report is finished, usefull when the report is used to memorize problem
virtual void OnCloseReport(int aNbLine,const std::string & anIdent,const std::string & aNameFile) const;

void InitReport(const std::string &anId,const std::string & aPost,bool IsMul,const std::vector<std::string> & aHeader={});
// void AddTopReport(const std::string &anId,const std::string & VecMsg);

void AddOneReportCSV(const std::string &anId,const std::vector<std::string> & VecMsg);
/// Add a header line, do it only it at top-level
void AddHeaderReportCSV(const std::string &anId,const std::vector<std::string> & VecMsg);

void AddStdHeaderStatCSV(const std::string &anId,const std::string & aNameCol1,const std::vector<int> aVPerc,const std::vector<std::string> & ={});
void AddStdStatCSV(const std::string &anId,const std::string & aCol1,const cStdStatRes &,const std::vector<int> aVPerc,const std::vector<std::string> & ={});
Expand Down
10 changes: 9 additions & 1 deletion MMVII/src/Appli/cMMVII_Appli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,15 @@ void cMMVII_Appli::AddObj2DelAtEnd(cObj2DelAtEnd * aPtrO)
mVectObj2DelAtEnd.insert(aPtrO);
}

cMMVII_Appli::~cMMVII_Appli()
void cMMVII_Appli::ToDoBeforeDestruction()
{
// Merge report call virtual methode :q
DoMergeReport();
}

cMMVII_Appli::~cMMVII_Appli()
{
// Maybe part, or all, the remaining can/should be done in ToDoBeforeDestruction ...
if (mMainAppliInsideP)
{
for (auto aPtrO : mVectObj2DelAtEnd)
Expand Down Expand Up @@ -781,8 +787,10 @@ void cMMVII_Appli::InitParam(cGenArgsSpecContext *aArgsSpecs)
const std::string & aNameInterval = mIntervFilterMS[aNum];
if (IsInit(&aNameInterval))
{
// JOE
cPatternTransfo aPat(mTransfoFFI[aNum]);
mVMainSets.at(aNum).Filter(Str2Interv<std::string>(aNameInterval),aPat);
// mVMainSets.at(aNum).Filter(Str2Interv<std::string>(aNameInterval));
}
}
// Test non empty
Expand Down
Loading

0 comments on commit f4fb2d0

Please sign in to comment.