Skip to content

Commit

Permalink
Merge branch 'mpd'
Browse files Browse the repository at this point in the history
  • Loading branch information
deseilligny committed Dec 13, 2023
2 parents 77fc501 + e9171d2 commit c2b550c
Show file tree
Hide file tree
Showing 27 changed files with 836 additions and 73 deletions.
17 changes: 15 additions & 2 deletions MMVII/MMVII-UseCaseDataSet/Circ-Code-Target/InfoNew.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
# GENERATE TARGET SPECIFICATION
MMVII CodedTargetGenerateEncoding CERN 14
MMVII CodedTargetGenerate CERN_Nbb14_Freq14_Hamm1_Run1000_1000_SpecEncoding.xml

# GENERATE META DATA
# As camera is knonw, once we set focal length to 24mm, MMVII will be abel to have an approximate calibration
MMVII EditCalcMTDI Std ModelCam ImTest=043_0005_Scaled.tif Modif=[.*_Scaled.tif,"NIKON D5600",0] Save=1
MMVII EditCalcMTDI Std Focalmm ImTest=043_0005_Scaled.tif Modif=[.*_Scaled.tif,24,0] Save=1
MMVII EditCalcMTDI Std AdditionalName ImTest=043_0005_Scaled.tif Modif=["(.*)_.*_.*","\$1",0] Save=1

# CREATE an initial calibration with default param
MMVII OriCreateCalib ".*tif" CalibInit

# Import GCP , we fix a coordinate system "Pannel", purely local, mainly for documentation
MMVII ImportGCP Data-Aux/Positions-3D-14bit_lookup.txt NXYZ Test NbDigName=3 ChSys=[LocalPannel]
MMVII CodedTargetCircExtract ".*_Scaled.tif" CERN_Nbb14_Freq14_Hamm1_Run1000_1000_FullSpecif.xml DiamMin=8 OutPointsMeasure=Test

# pose estimation init : resection + bundle
MMVII OriPoseEstimSpaceResection .*tif Test CalibInit Resec ThrRej=10 DirFiltered=Filt
MMVII OriBundleAdj .*tif Resec BA GCPW=[1,1] GCPDir=Filt


# research uncoded target + new bundle
MMVII CodedTargetCompleteUncoded .*_Scaled.tif BA 1.0 InPointsMeasure=Test ThRay=[1.05,4.7,5.3]
MMVII OriBundleAdj .*tif BA BA2 GCPW=[1,1,1,5] GCPDir=Completed/


# Generate a report on GCP quality
MMVII ReportGCP .*tif Completed BA2

# compute an initial value of the block
MMVII BlockCamInit .*tif BA2 "(.*)_(.*)_Scaled.tif" [1,2] Rig

# make a compensation with rigid block
MMVII OriBundleAdj .*tif BA2 BA3 GCPW=[1,1,1,5] GCPDir=Completed/ BRDirIn=Rig BRW=[1e-2,1e-5]



2 changes: 2 additions & 0 deletions MMVII/include/MMVII_DeclareAllCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ extern cSpecMMVII_Appli TheSpec_OriBundlAdj;
extern cSpecMMVII_Appli TheSpecDistCorrectCirgTarget;
extern cSpecMMVII_Appli TheSpecGenArgsSpec;
extern cSpecMMVII_Appli TheSpec_ImportGCP;
extern cSpecMMVII_Appli TheSpec_ImportTiePMul;
extern cSpecMMVII_Appli TheSpec_ImportMesImGCP;
extern cSpecMMVII_Appli TheSpec_ConvertV1V2_GCPIM;
extern cSpecMMVII_Appli TheSpec_SpecSerial;
extern cSpecMMVII_Appli TheSpec_CGPReport;
Expand Down
2 changes: 1 addition & 1 deletion MMVII/include/MMVII_MeasuresIm.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void AddData(const cAuxAr2007 & anAux,cTiePMul & aPMul);
class cVecTiePMul
{
public :
cVecTiePMul(const std::string & anIm);
cVecTiePMul(const std::string & );

std::string mNameIm;
std::vector<cTiePMul> mVecTPM;
Expand Down
6 changes: 5 additions & 1 deletion MMVII/include/MMVII_PCSens.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ class cPoseWithUK : public cObjWithUnkowns<tREAL8>
void GetAdrInfoParam(cGetAdrInfoParam<tREAL8> &) override;
// std::vector<tPtrOUK> GetAllUK() override;

// Val axiator should have to "equal" fix rot
cPt3dr ValAxiatorFixRot(const cRotation3D<tREAL8> & aRotFix) const;


private :
void PutUknowsInSetInterval() override ; // add the interval on udpate

Expand Down Expand Up @@ -452,7 +456,7 @@ class cSensorCamPC : public cSensorImage

const cPt3dr * CenterOfPC() const override;
/// Return the calculator, adapted to the type, for computing colinearity equation
cCalculator<double> * EqColinearity(bool WithDerives,int aSzBuf,bool ReUse) override;
cCalculator<double> * CreateEqColinearity(bool WithDerives,int aSzBuf,bool ReUse) override;
/// Push the current rotation, as equation are fixed using delta-rot
void PushOwnObsColinearity( std::vector<double> &) override;

Expand Down
18 changes: 14 additions & 4 deletions MMVII/include/MMVII_Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,22 @@ class cSensorImage : public cObj2DelAtEnd,
virtual cPt3dr PseudoCenterOfProj() const = 0;
/// For stenope camera return center, for other nullptr
virtual const cPt3dr * CenterOfPC() const = 0;
/// Return the calculator, adapted to the type, for computing colinearity equation
virtual cCalculator<double> * EqColinearity(bool WithDerives,int aSzBuf,bool ReUse) = 0;
// Create if new, and memorize the colinearity equation
cCalculator<double> * SetAndGetEqColinearity(bool WithDerives,int aSzBuf,bool ReUse);

// suppose it was init (and assert it)
cCalculator<double> * GetEqColinearity();

/// If the camera has its own "obs/cste" (like curent rot for PC-Cam) that's the place to say it
virtual void PushOwnObsColinearity( std::vector<double> &) = 0;

private :
std::string mNameImage;
/// Return the calculator, adapted to the type, for computing colinearity equation
virtual cCalculator<double> * CreateEqColinearity(bool WithDerives,int aSzBuf,bool ReUse) = 0;

std::string mNameImage;
cCalculator<double> * mEqColinearity; // memo equation, can be nullptr (for pure pose)
bool mEqCIsInit; // memo if init of "mEqColinearity" was done
// static std::map<std::string,cSensorImage*> mDicoSensor;
// static int mNum;
};
Expand Down Expand Up @@ -516,7 +525,8 @@ class cPhotogrammetricProject

std::string NameMultipleTieP(const std::string &) const;
void SaveMultipleTieP(const cVecTiePMul&,const std::string &) const;
void ReadMultipleTieP(cVecTiePMul&,const std::string & ) const;
void ReadMultipleTieP(cVecTiePMul&,const std::string &,bool SVP =false ) const;
bool HasNbMinMultiTiePoints(const std::string & aNameIm,size_t aNbMin,bool AcceptNoDirIn =false) const;

//===================================================================
//================== Coord Sys =========================
Expand Down
39 changes: 35 additions & 4 deletions MMVII/src/Appli/cMMVII_CalcSet.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#include "MMVII_2Include_Serial_Tpl.h"
#include "MMVII_DeclareAllCmd.h"
#include "MMVII_Sensor.h"


/** \file cMMVII_CalcSet.cpp
Expand Down Expand Up @@ -56,12 +56,15 @@ class cAppli_EditSet : public cMMVII_Appli
protected :
bool AcceptEmptySet(int aK) const override;
private :
cPhotogrammetricProject mPhProj;
std::string mNameXmlIn; ///< Save Input file, generally in-out
std::string mNameXmlOut; ///< Output file, when != Input
std::string mPat; ///< Pattern (or File) to modify
eOpAff mOp; ///< operator
int mShow; ///< Level of message
std::vector<std::string> mChgName;
std::string mPatFilter;
size_t mNbMinTieP;
};

cAppliBenchAnswer cAppli_EditSet::BenchAnswer() const
Expand Down Expand Up @@ -215,17 +218,23 @@ cCollecSpecArg2007 & cAppli_EditSet::ArgOpt(cCollecSpecArg2007 & anArgOpt)
<< AOpt2007(mShow,"Show","Show detail of set before/after, 0->none, (1) modif, (2) all",{{eTA2007::HDV}})
<< AOpt2007(mNameXmlOut,"Out","Destination, def=Input, no save for " + MMVII_NONE,{})
<< AOpt2007(mChgName,"ChgN","Change name [Pat,Name], for ex \"[(.*),IMU_\\$0]\" add prefix \"IMU_\" ",{{eTA2007::ISizeV,"[2,2]"}})
<< mPhProj.DPMulTieP().ArgDirInOpt("TiePF","TieP for filtering on number")
<< AOpt2007(mNbMinTieP,"NbMinTieP","Number min of tie points, if TiePF",{{eTA2007::HDV}})
<< AOpt2007(mPatFilter,"PatF","Pattern to filter on name")
;
}

cAppli_EditSet::cAppli_EditSet(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cMMVII_Appli (aVArgs,aSpec),
mShow (0)
mPhProj (*this),
mShow (0),
mNbMinTieP (1)
{
}

int cAppli_EditSet::Exe()
{
mPhProj.FinishInit();

InitOutFromIn(mNameXmlOut,mNameXmlIn);

Expand All @@ -244,11 +253,33 @@ int cAppli_EditSet::Exe()
}

// StdOut() << "aNewaNewaNew " << aNew.size() << std::endl;

tNameSet aRes = aInput.Dupl();

aRes.OpAff(mOp,aNew);

if (IsInit(&mPatFilter))
{
tNameSelector aSel = AllocRegex(mPatFilter);
tNameSet aNewRes;
for (const auto & aName : ToVect(aRes))
{
if (aSel.Match(aName))
aNewRes.Add(aName);
}
aRes = aNewRes;
}

if (mPhProj.DPMulTieP().DirInIsInit())
{
tNameSet aNewRes;
for (const auto & aName : ToVect(aRes))
{
if (mPhProj.HasNbMinMultiTiePoints(aName,mNbMinTieP,true))
aNewRes.Add(aName);
}
aRes = aNewRes;
}


if (mShow)
{
tNameSet aTot(aInput+aNew);
Expand Down
76 changes: 50 additions & 26 deletions MMVII/src/Appli/cMMVII_Rename.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,37 @@ class cAppli_DicoRename : public cMMVII_Appli
protected :
private :
cPhotogrammetricProject mPhProj;
std::string mNameFile;
std::string mNameFileTxtIn;
std::string mFormat;
std::vector<std::string> mPatSubst;
std::vector<std::string> mPatIm;
std::string mNameDico;
std::vector<std::string> mNameFiles;
int mL0;
int mLLast;
char mComment;
std::string mSeparator;
int mNbMinTieP;
std::vector<std::string> mNameFilesListIm;

};

cAppli_DicoRename::cAppli_DicoRename(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cMMVII_Appli (aVArgs,aSpec),
mPhProj (*this),
mL0 (0),
mLLast (-1),
mComment ('#'),
mSeparator ("@")
cMMVII_Appli (aVArgs,aSpec),
mPhProj (*this),
mL0 (0),
mLLast (-1),
mComment ('#'),
mSeparator ("@"),
mNbMinTieP (0),
mNameFilesListIm {"AllImDicoIn.xml","AllImDicoOut.xml"}
{
}

cCollecSpecArg2007 & cAppli_DicoRename::ArgObl(cCollecSpecArg2007 & anArgObl)
{
return anArgObl
<< Arg2007(mNameFile ,"Name of Input File")
<< Arg2007(mNameFileTxtIn ,"Name of Input File")
<< Arg2007(mFormat ,"Format of file as for ex \"SNSXYZSS\" ")
<< Arg2007(mPatSubst ,"Substitution pattern [Pattern,SubstIn,SubstOut]",{{eTA2007::ISizeV,"[3,3]"}})
<< Arg2007(mPatIm ,"Substitution pattern [Pattern,SubstIn,SubstOut]",{{eTA2007::ISizeV,"[3,3]"}})
<< Arg2007(mNameDico ,"Name for output dictionnary")
;
}
Expand All @@ -66,7 +69,8 @@ cCollecSpecArg2007 & cAppli_DicoRename::ArgOpt(cCollecSpecArg2007 & anArgObl)
<< 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})
<< AOpt2007(mComment,"Com","Carac for commentary",{eTA2007::HDV})
<< AOpt2007(mNameFiles,"Files","Name file to transform [Input,Output)",{{eTA2007::ISizeV,"[2,2]"}})
<< AOpt2007(mNameFilesListIm,"Files","Name file to transform [Input,Output]",{{eTA2007::ISizeV,"[2,2]"},eTA2007::HDV})
<< AOpt2007(mNbMinTieP,"NbMinTiep","Number minimal of tie point for save, set -1 if save w/o tiep",{eTA2007::HDV})

<< mPhProj.DPMulTieP().ArgDirInOpt()
<< mPhProj.DPMulTieP().ArgDirOutOpt()
Expand All @@ -87,7 +91,7 @@ int cAppli_DicoRename::Exe()

ReadFilesStruct
(
mNameFile, mFormat,
mNameFileTxtIn, mFormat,
mL0, mLLast, mComment,
aVVNames,aVXYZ,aVWKP,aVNums,
false
Expand All @@ -100,8 +104,8 @@ int cAppli_DicoRename::Exe()
for (size_t aKName=1 ; aKName<aVNames.size() ; aKName++)
aCatName = aCatName + mSeparator + aVNames.at(aKName);

std::string aNameIn = ReplacePattern(mPatSubst.at(0),mPatSubst.at(1),aCatName);
std::string aNameOut = ReplacePattern(mPatSubst.at(0),mPatSubst.at(2),aCatName);
std::string aNameIn = ReplacePattern(mPatIm.at(0),mPatIm.at(1),aCatName);
std::string aNameOut = ReplacePattern(mPatIm.at(0),mPatIm.at(2),aCatName);

aDico[aNameIn] = aNameOut;

Expand All @@ -110,9 +114,11 @@ int cAppli_DicoRename::Exe()

SaveInFile(aDico,mNameDico);

/*
if (IsInit(&mNameFiles))
{
auto aSetIn = ToVect(SetNameFromString(mNameFiles.at(0),true));
tNameSet aSetIn;
tNameSet aSetOut;
for (const auto & aNameIn : aSetIn)
Expand All @@ -123,25 +129,43 @@ int cAppli_DicoRename::Exe()
aSetOut.Add(anIter->second);
}
}
SaveInFile(aSetIn,mNameFiles.at(0));
SaveInFile(aSetOut,mNameFiles.at(1));
}
*/

if (mPhProj.DPMulTieP().DirInIsInit())
bool isInitMTP = mPhProj.DPMulTieP().DirInIsInit();
if (isInitMTP)
{
MMVII_INTERNAL_ASSERT_User(mPhProj.DPMulTieP().DirOutIsInit(),eTyUEr::eUnClassedError,"MulTieP In w/o Out");
for (const auto & aPair : aDico)
}
tNameSet aSetIn;
tNameSet aSetOut;
for (const auto & [aNameIn,aNameOut] : aDico)
{
bool hasTieP = isInitMTP
&& ExistFile(mPhProj.DPMulTieP().FullDirIn()+ mPhProj.NameMultipleTieP(aNameIn));
int aNbTieP = isInitMTP ? -1 : 0;
if (hasTieP)
{
if (ExistFile(mPhProj.DPMulTieP().FullDirIn()+ mPhProj.NameMultipleTieP(aPair.first)))
{
cVecTiePMul aVTPM("toto");
mPhProj.ReadMultipleTieP(aVTPM,aPair.first);
mPhProj.SaveMultipleTieP(aVTPM,aPair.second);
}
else
{
}
cVecTiePMul aVTPM("toto");
mPhProj.ReadMultipleTieP(aVTPM,aNameIn);
aVTPM.mNameIm = aNameOut;
aNbTieP = aVTPM.mVecTPM.size();
mPhProj.SaveMultipleTieP(aVTPM,aNameOut);
}
else
{
}

if (aNbTieP >= mNbMinTieP)
{
aSetIn.Add(aNameIn);
aSetOut.Add(aNameOut);
}
}
SaveInFile(aSetIn ,mNameFilesListIm.at(0));
SaveInFile(aSetOut,mNameFilesListIm.at(1));

if (mPhProj.DPPointsMeasures().DirInIsInit())
{
Expand Down
2 changes: 2 additions & 0 deletions MMVII/src/Appli/cSpecMMVII_Appli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ std::vector<cSpecMMVII_Appli *> & cSpecMMVII_Appli::InternVecAll()
TheVecAll.push_back(&TheSpec_CreateRTL);
TheVecAll.push_back(&TheSpec_ChSysCo);
TheVecAll.push_back(&TheSpec_CreateCalib);
TheVecAll.push_back(&TheSpec_ImportTiePMul);
TheVecAll.push_back(&TheSpec_ImportMesImGCP);

std::sort(TheVecAll.begin(),TheVecAll.end(),CmpCmd);
}
Expand Down
23 changes: 23 additions & 0 deletions MMVII/src/Bench/BenchGeom.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "MMVII_Geom2D.h"
#include "MMVII_Geom3D.h"
#include "MMVII_Tpl_Images.h"
#include "MMVII_PCSens.h"

namespace MMVII
{
Expand Down Expand Up @@ -177,8 +178,30 @@ template<class Type> void TplBenchRotation3D(cParamExeBench & aParam)
// StdOut() << "============================" << std::endl;
}

void BenchRotation3DReal8()
{
tREAL8 aEps = 0.2;
for (int aKT=0 ; aKT<100 ; aKT++)
{
cRotation3D<tREAL8> aR0 = cRotation3D<tREAL8>::RandomRot();
cRotation3D<tREAL8> aRTarget = aR0*cRotation3D<tREAL8>::RandomRot(aEps);

cPoseWithUK aPUK(tPoseR(cPt3dr(0,0,0),aR0));

for (int aKIter=0 ; aKIter<5; aKIter++)
{
cPt3dr W = aPUK.ValAxiatorFixRot(aRTarget);
aPUK.Omega() = W;
aPUK.OnUpdate();
}
tREAL8 aD = aRTarget.Mat().L2Dist(aPUK.Pose().Rot().Mat()) ;
MMVII_INTERNAL_ASSERT_bench(aD <1e-10,"FromTriInAndOut p1 !!");
}
}

void BenchRotation3D(cParamExeBench & aParam)
{
BenchRotation3DReal8();
TplBenchRotation3D<tREAL4 >(aParam);
TplBenchRotation3D<tREAL8 >(aParam);
TplBenchRotation3D<tREAL16>(aParam);
Expand Down
Loading

0 comments on commit c2b550c

Please sign in to comment.