Skip to content

Commit

Permalink
Merge branch 'mpd'
Browse files Browse the repository at this point in the history
  • Loading branch information
deseilligny committed May 16, 2024
2 parents a9533b1 + 729e082 commit e8774cc
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 19 deletions.
5 changes: 4 additions & 1 deletion MMVII/include/MMVII_Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,10 @@ class cPhotogrammetricProject
/// Does the image has an existing mask : Dir is init + file exist
bool ImageHasMask(const std::string & aNameImage) const;

cIm2D<tU_INT1> MaskWithDef(const std::string & aNameImage,const cBox2di & aBox,bool DefVal) const;
// read masq of image, if OkNoMasq accept masq dont exist, return a masq full or empty if file dont exist (depend DefVal)
cIm2D<tU_INT1> MaskWithDef(const std::string & aNameImage,const cBox2di & aBox,bool DefVal,bool OkNoMasq=true) const;
// read masq , generate error if dont exist
cIm2D<tU_INT1> MaskOfImage(const std::string & aNameImage,const cBox2di & aBox) const;

//===================================================================
//================== PointsMeasures =============================
Expand Down
18 changes: 11 additions & 7 deletions MMVII/src/CodedTarget/cCircTargetExtract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ cCircTargExtr::cCircTargExtr(const cExtractedEllipse & anEE) :
mWithCode (false),
mCardDetect (1) // By default, let be optimistic
{

}


Expand Down Expand Up @@ -141,7 +142,7 @@ class cCCDecode

cCCDecode(cCircTargExtr & anEE,tCDIm & aDIm,tCDIm & aDGx , tCDIm & aDGy,const cFullSpecifTarget &,const cThresholdCircTarget &);

void Show(const std::string & aPrefix);
void ShowCDecoded(const std::string & aPrefix);

/// Compute phase minimizing standard deviation, make a decision if its low enough
void ComputePhaseTeta() ;
Expand Down Expand Up @@ -206,6 +207,7 @@ class cCCDecode
tREAL8 mWhite;
tREAL8 mBWAmpl;
tREAL8 mBWAvg;
size_t mFlagCode;
const cOneEncoding * mEnCode;
bool mOkGrad;
bool mMarked4Test;
Expand Down Expand Up @@ -455,11 +457,12 @@ void cCCDecode::ComputeCode()

// flag for coding must be eventually inverted, depending of orientation convention
{
size_t aFlagCode = aFlag;
mFlagCode = aFlag;

if (! mSpec.AntiClockWiseBit())
aFlagCode = BitMirror(aFlag,size_t(1)<<mSpec.NbBits());
mFlagCode = BitMirror(aFlag,size_t(1)<<mSpec.NbBits());

mEnCode = mSpec.EncodingFromCode(aFlagCode);
mEnCode = mSpec.EncodingFromCode(mFlagCode);

if (! mEnCode) return;
}
Expand Down Expand Up @@ -581,7 +584,7 @@ void cCCDecode::ComputeCode()



void cCCDecode::Show(const std::string & aPrefix)
void cCCDecode::ShowCDecoded(const std::string & aPrefix)
{
static int aCpt=0; aCpt++;

Expand All @@ -600,7 +603,7 @@ void cCCDecode::Show(const std::string & aPrefix)

aIm.ToJpgFileDeZoom(aPrefix + "_ImPolar_"+ToStr(aCpt)+".tif",1);

StdOut() << "Adr=" << mEnCode << " Ok=" << mOK;
StdOut() << "Adr=" << mEnCode << " Ok=" << mOK << " BitCode=" << StrOfBitFlag(mFlagCode,2<<mNbB) ;
if (mEnCode)
{
StdOut() << " Name=" << mEnCode->Name()
Expand Down Expand Up @@ -956,6 +959,7 @@ int cAppliExtractCircTarget::ExeOnParsedBox()
}
double aT0 = SecFromT0();

// StdOut() << "JJJJJJ " << mPhProj.NameMaskOfImage(mNameIm) << "\n";
mExtrEll = new cExtract_BW_Ellipse(APBI_Im(),mPBWT,mPhProj.MaskWithDef(mNameIm,CurBoxIn(),false));

double aT1 = SecFromT0();
Expand Down Expand Up @@ -992,7 +996,7 @@ int cAppliExtractCircTarget::ExeOnParsedBox()
cCCDecode aCCD(*anEE,APBI_DIm(),mExtrEll->DGx(),mExtrEll->DGy(),*mSpec,mThresh);
if (anEE->mMarked4Test)
{
aCCD.Show(mPrefixOut);
aCCD.ShowCDecoded(mPrefixOut);
}
}

Expand Down
9 changes: 6 additions & 3 deletions MMVII/src/CodedTarget/cGenerateEncoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,12 @@ int cAppliGenerateEncoding::Exe()

if (mUseAiconCode)
{
// Read the file in ressources MMVII
std::vector<cPt2di> aVCode ;
ReadCodesTarget(aVCode,cCompEquiCodes::NameCERNLookUpTable(mSpec.mNbBits));

// In this case, by default, take all the code that were specified
SetIfNotInit(mSpec.mMaxNb,aVCode.size());
std::list<cCompEquiCodes::tAmbigPair> aLamb = mCEC->AmbiguousCode(aVCode);

if (!aLamb.empty())
Expand Down Expand Up @@ -528,10 +531,10 @@ int cAppliGenerateEncoding::Exe()
SortOnCriteria(mVOC,[](auto aPCel){return aPCel->mLowCode;});
{
cBitEncoding aBE;
for (size_t aK=0 ; aK<mVOC.size(); aK++)
for (size_t aK1=0 ; aK1<mVOC.size(); aK1++)
{
size_t aNum = aK + Num000;
size_t aCode = mVOC[aK]->mLowCode;
size_t aNum = aK1 + Num000;
size_t aCode = mVOC[aK1]->mLowCode;
aBE.AddOneEncoding(aNum,aCode); // add a new encoding

// Update all ranges
Expand Down
9 changes: 5 additions & 4 deletions MMVII/src/CodedTarget/cGenerateTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,8 @@ eTyCodeTarget cAppliGenCodedTarget::Type() {return mBE.Specs().mType ;}
cAppliGenCodedTarget::cAppliGenCodedTarget(const std::vector<std::string> & aVArgs,const cSpecMMVII_Appli & aSpec) :
cMMVII_Appli (aVArgs,aSpec),
mPerGen (10),
mDoMarkC (false)
mDoMarkC (false),
mNbPixBin (1800)
{
}

Expand Down Expand Up @@ -1011,7 +1012,7 @@ cCollecSpecArg2007 & cAppliGenCodedTarget::ArgOpt(cCollecSpecArg2007 & anArgOpt)
<< AOpt2007(mPCT.mRayOrientTablet,"SzOrFig","Size of \"diamond\" for orientation")
<< AOpt2007(mDoMarkC,"MarkC","Mark center of bits, just for verif ",{eTA2007::HDV,eTA2007::Tuning})
<< AOpt2007(mZoomShow,"ZoomShow","Zoom to generate a high resolution check images",{eTA2007::Tuning})
<< AOpt2007(mNbPixBin,"NbPixBin","Size of binary image when printing")
<< AOpt2007(mNbPixBin,"NbPixBin","Size of binary image when printing",{eTA2007::HDV})
;
}

Expand All @@ -1022,8 +1023,8 @@ int cAppliGenCodedTarget::Exe()

// anAppli.SetIfNotInit(mWithParity,false);

if (IsInit(&mNbPixBin))
mPCT.SetNbPixBin(mNbPixBin);
//if (IsInit(&mNbPixBin))
mPCT.SetNbPixBin(mNbPixBin);

ReadFromFile(mBE,mNameBE);
mPCT.FinishInitOfSpec(mBE.Specs());
Expand Down
4 changes: 3 additions & 1 deletion MMVII/src/CodedTarget/cSimulTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ double cResSimul::BorderGlob() const

void AddData(const cAuxAr2007 & anAux,cResSimul & aRS)
{
MMVII::AddData(cAuxAr2007("Com",anAux),aRS.mCom);
// Modif MPD, know that commande are quoted, they cannot be used as tag => "MMVII "toto" "b=3" " => PB!!
// MMVII::AddData(cAuxAr2007("Com",anAux),aRS.mCom);
anAux.Ar().AddComment(aRS.mCom);
MMVII::AddData(cAuxAr2007("RayMinMax",anAux),aRS.mRayMinMax);
MMVII::AddData(cAuxAr2007("RatioMax",anAux),aRS.mRatioMax);
MMVII::AddData(cAuxAr2007("Geoms",anAux),aRS.mVG);
Expand Down
27 changes: 27 additions & 0 deletions MMVII/src/Geom3D/cRotation3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,33 @@ template <class Type> cRotation3D<Type>::cRotation3D(const cDenseMatrix<Type> &
{
mMat = mMat.ClosestOrthog();
}
else
{
#if (The_MMVII_DebugLevel>=The_MMVII_DebugLevel_InternalError_tiny )
cPtxd<Type,3> aI = AxeI();
cPtxd<Type,3> aJ = AxeJ();
cPtxd<Type,3> aK = AxeK();

// "Epsilon value" set empirically taking into account the value obseved on current bench

// are the vector unitar, take into account accuracy of type
tREAL8 aDifN = (std::abs(SqN2(aI)-1)+std::abs(SqN2(aJ)-1)+std::abs(SqN2(aK)-1)) / tElemNumTrait<Type>::Accuracy() ;
MMVII_INTERNAL_ASSERT_tiny(aDifN<1e-3,"Rotation 3D init non norm w/o RefineIt");

// are the vector orthognal, take into account accuracy of type
tREAL8 aDifS = (std::abs(Scal(aI,aJ))) / tElemNumTrait<Type>::Accuracy() ;
MMVII_INTERNAL_ASSERT_tiny(aDifS<1e-4,"Rotation 3D init non orthog w/o RefineIt");

/*
static tREAL8 aMaxDif=0;
if (aDifS> aMaxDif)
{
aMaxDif = aDifS;
StdOut() << "*********************** ******************** DIFFSSS=" << tNumTrait<Type>::NameType() << " "<< aMaxDif << "\n";
}
*/
#endif
}
// MMVII_INTERNAL_ASSERT_always((! RefineIt),"Refine to write in Rotation ...");
}

Expand Down
13 changes: 13 additions & 0 deletions MMVII/src/ImagesInfoExtract/ExtractBWTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ bool cExtract_BW_Target::AnalyseOneConnectedComponents(cSeedBWTarget & aSeed)
// if the point has been explored or is in border
if (! MarqFree(aP0))
{
if (aSeed.mMarked4Test)
StdOut() << "### For Marked point " << aSeed.mPixW << " Point has already been explored ###" << std::endl;

aSeed.mOk = false;
return false;
}
Expand Down Expand Up @@ -315,6 +318,16 @@ bool cExtract_BW_Target::AnalyseOneConnectedComponents(cSeedBWTarget & aSeed)

if ((mPtsCC.size() >= aMaxNbPts) || touchOther || (int(mPtsCC.size()) < mPBWT.NbMinPtsCC()))
{
if (aSeed.mMarked4Test)
{
if (mPtsCC.size() >= aMaxNbPts)
StdOut() << "====> ### For Marked point " << aSeed.mPixW << " too many points:" << mPtsCC.size() << " ###" << std::endl;
if (touchOther)
StdOut() << "====> ### For Marked point " << aSeed.mPixW << " touchOther " << " ###" << std::endl;
if (int(mPtsCC.size()) < mPBWT.NbMinPtsCC())
StdOut() << "====> ### For Marked point " << aSeed.mPixW << " not enough point:" << mPtsCC.size() << " ###" << std::endl;
}

CC_SetMarq(eEEBW_Lab::eBadZ);
return false;
}
Expand Down
8 changes: 7 additions & 1 deletion MMVII/src/Sensors/cPhotogrammetricProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,16 +670,22 @@ bool cPhotogrammetricProject::ImageHasMask(const std::string & aNameImage) cons
&& ExistFile(NameMaskOfImage(aNameImage)) ;
}

cIm2D<tU_INT1> cPhotogrammetricProject::MaskWithDef(const std::string & aNameImage,const cBox2di & aBox,bool DefVal) const
cIm2D<tU_INT1> cPhotogrammetricProject::MaskWithDef(const std::string & aNameImage,const cBox2di & aBox,bool DefVal,bool OkNoMasq) const
{
if (ImageHasMask( aNameImage))
{
return cIm2D<tU_INT1>::FromFile(NameMaskOfImage(aNameImage),aBox);
}

MMVII_INTERNAL_ASSERT_always(OkNoMasq,"Masq dont exist for image : " + aNameImage);

return cIm2D<tU_INT1> (aBox.Sz(),nullptr, (DefVal ? eModeInitImage::eMIA_V1 : eModeInitImage::eMIA_Null)) ;
}

cIm2D<tU_INT1> cPhotogrammetricProject::MaskOfImage(const std::string & aNameImage,const cBox2di & aBox) const
{
return MaskWithDef(aNameImage,aBox,false,false);
}

// ============= PointsMeasures =================

Expand Down
4 changes: 2 additions & 2 deletions MMVII/src/Serial/SerialByTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ void cXmlSerialTokenParser::CheckOnClose(const cSerialTree & aTree,const std::st
{
if (aTree.Value() != aStr)
{
StdOut()<< "Expected : [" << aStr << "], Got : [" << aTree.Value()<< "] " << std::endl;
MMVII_INTERNAL_ASSERT_tiny(false,"Close tag unexpected");
StdOut()<< "Expected : [" << aTree.Value() << "], Got : [" << aStr << "] " << std::endl;
MMVII_INTERNAL_ASSERT_tiny(false,"Close tag unexpected in file "+ mMMIs.Name());
}

}
Expand Down

0 comments on commit e8774cc

Please sign in to comment.