Skip to content

Commit

Permalink
Merge branch 'mpd'
Browse files Browse the repository at this point in the history
  • Loading branch information
deseilligny committed Nov 13, 2024
2 parents b08ea76 + e3783c2 commit 53b7bea
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 14 deletions.
6 changes: 6 additions & 0 deletions MMVII/src/CodedTarget/CodedTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ class cParamCodedTarget : public cMemCheck
double mThickN_Car; ///< thickness of black border
double mThickN_BorderExt; ///< thickness of border

/** Factor to empirically make carac larger, probably redundant with other ...*/
double mFactEnlargeCar;

double mChessboardAng; ///< Origine angle of chessboard pattern
bool mWithChessboard; ///< do we have a cental chess board, true 4 IGN
bool mWhiteBackGround; ///< black on white, true 4 IGN
Expand All @@ -329,6 +332,9 @@ class cParamCodedTarget : public cMemCheck
double mRho_4_EndCar; // radius where begins the coding stuff
double mRho_EndIm; // radius where begins the coding stuff
double mSignAngle;

size_t mSzHalfStr; // size of longest of 2 half string
cPt2dr mPSzCar;

cPt2di mSzBin;
double mScale; // Sz of Pixel in normal coord
Expand Down
9 changes: 8 additions & 1 deletion MMVII/src/CodedTarget/cGenerateEncoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ int cAppliGenerateEncoding::Exe()
if (mSpec.mFreqCircEq==0)
mSpec.mFreqCircEq = mSpec.mNbBits;

bool mCompactNum = true;

// make all default init that are type-dependant
if (mSpec.mType==eTyCodeTarget::eIGNIndoor)
Expand All @@ -349,6 +350,7 @@ int cAppliGenerateEncoding::Exe()
else if (mSpec.mType==eTyCodeTarget::eCERN)
{
mUseAiconCode = true;
mCompactNum = false;
SetIfNotInit(mSpec.mParity,size_t(2));
Num000 = 1;
}
Expand Down Expand Up @@ -542,7 +544,12 @@ int cAppliGenerateEncoding::Exe()
size_t aNum = aK1 + Num000;
// StdOut() << "NNNNNnnN= " << aNum << " " << mVOC[aK1]->mNum << "\n";
MMVII_INTERNAL_ASSERT_strong(mVOC[aK1]->mNum>=0,"Num was not correctly set in cCelCC");
aNum = mVOC[aK1]->mNum;
// For AICON-like, with external spec, with maintain the numerotation, for internal MMVII system, we
// prefer to "compactify" the numbering
if (! mCompactNum)
{
aNum = mVOC[aK1]->mNum;
}
size_t aCode = mVOC[aK1]->mLowCode;
aBE.AddOneEncoding(aNum,aCode); // add a new encoding

Expand Down
66 changes: 53 additions & 13 deletions MMVII/src/CodedTarget/cGenerateTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,12 @@ cParamCodedTarget::cParamCodedTarget(int aNbPixBin) :
mSzGaussDeZoom (3),
mNbPixelBin (-1), // Put fake value, because init is done later
mSz_CCB (1),
mThickN_WInt (0.35),
mThickN_WInt (0.5),
mThickN_Code (0.35),
mThickN_WExt (0.2),
mThickN_Car (0.5),
mThickN_BorderExt (0.05),
mThickN_WExt (0.04),
mThickN_Car (0.7),
mThickN_BorderExt (0.04),
mFactEnlargeCar (1.0),
mChessboardAng (0.0),
mWithChessboard (true),
mWhiteBackGround (true),
Expand Down Expand Up @@ -252,6 +253,7 @@ void cParamCodedTarget::FinishInitOfSpec(const cSpecBitEncoding & aSpec)
anAppli.SetIfNotInit(mThickN_WExt,0.0);
anAppli.SetIfNotInit(mThickN_Car,0.3);
anAppli.SetIfNotInit(mChessboardAng,-M_PI/4.0);
anAppli.SetIfNotInit(mThickN_BorderExt,-0.0);

anAppli.SetIfNotInit(mRadiusOrientTablet,0.1);
anAppli.SetIfNotInit(mCenterOrientTablet,cPt2dr(0.7,0));
Expand All @@ -264,12 +266,18 @@ void cParamCodedTarget::FinishInitOfSpec(const cSpecBitEncoding & aSpec)
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.0);
anAppli.SetIfNotInit(mThickN_WExt,1.0);
anAppli.SetIfNotInit(mThickN_BorderExt,-0.0);

anAppli.SetIfNotInit(mWithChessboard,false);
anAppli.SetIfNotInit(mWhiteBackGround,false);
anAppli.SetIfNotInit(mAntiClockWiseBit,false);
}
mThickN_Car *= (aSpec.mNbDigit+1)/2;
mSzHalfStr = (aSpec.mNbDigit+1)/2;

// StdOut() << " mThickN_CarmThickN_Car " << mThickN_Car << " " << (aSpec.mNbDigit+1)/2 << "\n";
// Split string in 2
mThickN_Car *= mSzHalfStr;
}

cPt2dr cParamCodedTarget::Pix2Norm(const cPt2dr & aPix) const
Expand Down Expand Up @@ -321,14 +329,41 @@ void cParamCodedTarget::Finish()
aCumulThick += mThickN_WExt;
mRho_3_BeginCar = mSz_CCB * aCumulThick;


mThickN_Car = std::min(mThickN_Car, mRho_2_EndCode * (sqrt(2)-1));
{
std::string aS(mSzHalfStr,'s');
cIm2D<tU_INT1> aImStr = ImageOfString_10x8(aS,1);
cPt2dr aSz = ToR(aImStr.DIm().Sz());
aSz = aSz / NormInf(aSz);

// (l x-R3)^ + (ly-R3)^2 = R3^2
// l^2 (x2+y2) - 2lR3 (x+y) + 2R3^2 - R3^2
// For l : a L2 + b L + C

tREAL8 a = SqN2(aSz);
tREAL8 b = -2 * mRho_3_BeginCar * Norm1(aSz);
tREAL8 c = 2*Square(mRho_3_BeginCar) - Square(mRho_3_BeginCar);

// l = (-b +-sqrt(b2-4ac))/2a
tREAL8 aDelta = Square(b) - 4 * a * c;
// smallest root
tREAL8 aL1 = (-b - sqrt(aDelta)) / (2*a);
mPSzCar = aSz * aL1;

}

mRho_4_EndCar = mRho_3_BeginCar;
/*
mRho_4_EndCar = std::max
(
mRho_3_BeginCar,
mRho_3_BeginCar/sqrt(2) + mThickN_Car
mRho_3_BeginCar/sqrt(2) + (mThickN_Car*mSz_CCB)
);
*/


aCumulThick = mRho_4_EndCar;
aCumulThick = mRho_4_EndCar / mSz_CCB;
aCumulThick += mThickN_BorderExt;
mRho_EndIm = mSz_CCB * aCumulThick;

Expand Down Expand Up @@ -361,7 +396,6 @@ void cParamCodedTarget::Finish()
<< "r4 : " << mRho_4_EndCar << "\n"
<< "r5 : " << mRho_EndIm << "\n";

getchar();
}
}

Expand Down Expand Up @@ -674,6 +708,7 @@ cCodedTargetPatternIm::cCodedTargetPatternIm(cFullSpecifTarget & aSpec) :
mRayCT (mRender.mRadiusCenterMiniTarget),
mRay2CT (Square(mRayCT))
{

mDIC.InitCste(tElem(eLPT::eBackGround));

// Structures for computing center of bits
Expand Down Expand Up @@ -727,6 +762,7 @@ cCodedTargetPatternIm::cCodedTargetPatternIm(cFullSpecifTarget & aSpec) :
// compute and memorize the center
for (size_t aB=0 ; aB< aVWeight.size() ; aB++)
{

mSpec.SetBitCenter(aB,aVCenters.at(aB) / tREAL8(aVWeight.at(aB) * mSpec.DeZoomIm() ));
}
}
Expand Down Expand Up @@ -776,10 +812,14 @@ cCodedTargetPatternIm::tIm cCodedTargetPatternIm::MakeOneImTarget(const cOneEnco

// Corners of string,
cPt2di aP00 = PDiag(mRender.mRho_4_EndCar);
cPt2di aP11 = PDiag(mRender.mRho_4_EndCar-mRender.mThickN_Car) ; // for a 1 length caracr
// cPt2di aP11 = PDiag(mRender.mRho_4_EndCar-mRender.mThickN_Car *mRender.mFactEnlargeCar) ; // for a 1 length caracr
cPt2di aP11 = aP00 + ToI(mRender.mPSzCar*mRender.mScale);

//StdOut() << " P00=" << aP00 << " P11=" << aP11 << " SzC=" << mRender.mPSzCar << " SC=" << mRender.mScale << "\n";

// udate highth of string, to adapt to length (aIndSplit is maximal legnt of 2 substrings)
int aHigth = (aP11.y()-aP00.y()) / aIndSplit;
// int aHigth = (aP11.y()-aP00.y()) / aIndSplit;
int aHigth = (aP11.y()-aP00.y()) ;
aP11 = cPt2di(aP11.x(),aP00.y() + aHigth);

// loop for processing the 2 subsrt string
Expand Down Expand Up @@ -815,8 +855,8 @@ cCodedTargetPatternIm::tIm cCodedTargetPatternIm::MakeOneImTarget(const cOneEnco

for (const auto& aPixIm : cRect2(aP0,aP1))
{
mDIT.SetV(aPixIm,aFG_StrCoul);
mDIT.SetV(aP4Sym-aPixIm,aFG_StrCoul);
mDIT.SetVTruncIfInside(aPixIm,aFG_StrCoul);
mDIT.SetVTruncIfInside(aP4Sym-aPixIm,aFG_StrCoul);
}
}
}
Expand Down

0 comments on commit 53b7bea

Please sign in to comment.