@@ -14,14 +14,12 @@ template <class Type> cExtractDir<Type>::cExtractDir(tIm anIm,double aRhoMin,do
1414 mPtsCrown (SortedVectOfRadius(0.0 ,mRhoMax )) // compute vectot of neighboord sorted by norm
1515{
1616 // compute list of circles with a step of 1 pixel, and their direction
17- for (double aRho = aRhoMin ; aRho<aRhoMax ; aRho++)
18- {
17+ for (double aRho = aRhoMin ; aRho<aRhoMax ; aRho++){
1918 mVCircles .push_back (GetPts_Circle (cPt2dr (0 ,0 ),aRho,true )); // true=> 8 connexity
2019 mVDIrC .push_back (tVDir ());
2120
2221 // compute direction real that will be used for extracting axes of checkboard
23- for (const auto & aPix : mVCircles .back ())
24- {
22+ for (const auto & aPix : mVCircles .back ()){
2523 mVDIrC .back ().push_back (VUnit (ToR (aPix)));
2624 }
2725 }
@@ -135,19 +133,19 @@ template <class Type> bool cExtractDir<Type>::CalcDir(tDCT & aDCT){
135133 int aKp1 = (aKp+1 )%aNbInC; // next index, circulary speaking
136134 if (aVIsW[aKp] != aVIsW[aKp1]){ // if we have a transition
137135
138- aCpt++; // one more transition
139- cPt2dr aP1 = aVDir[aKp]; // unitary direction before transition
140- cPt2dr aP2 = aVDir[aKp1]; // unitary direction after transition
141- double aV1 = aVVals[aKp]; // value befor trans
142- double aV2 = aVVals[aKp1]; // value after trans
143- // make a weighted average of P1/P2 corresponding to linear interpolation with threshold
144- cPt2dr aDir = (aP1 *(aV2-mVThrs ) + aP2 * (mVThrs -aV1)) / (aV2-aV1);
136+ aCpt++; // one more transition
137+ cPt2dr aP1 = aVDir[aKp]; // unitary direction before transition
138+ cPt2dr aP2 = aVDir[aKp1]; // unitary direction after transition
139+ double aV1 = aVVals[aKp]; // value befor trans
140+ double aV2 = aVVals[aKp1]; // value after trans
141+ // make a weighted average of P1/P2 corresponding to linear interpolation with threshold
142+ cPt2dr aDir = (aP1 *(aV2-mVThrs ) + aP2 * (mVThrs -aV1)) / (aV2-aV1);
145143
146- if (SqN2 (aDir)==0 ) return false ; // not interesting case
147- aDir = VUnit (aDir); // reput to unitary
144+ if (SqN2 (aDir)==0 ) return false ; // not interesting case
145+ aDir = VUnit (aDir); // reput to unitary
148146
149147 // -----------------------------------------------------------------------------------
150- // REPRESENTATION TRANSITIONS
148+ // REPRESENTATION OF TRANSITIONS
151149 aDCT.mDetectedVectors .push_back (cPt2di (aC.x ()+radius*aDir.x (), aC.y ()+radius*aDir.y ()));
152150 // -----------------------------------------------------------------------------------
153151
@@ -270,19 +268,19 @@ template <class Type> double cExtractDir<Type>::ScoreRadiom(tDCT & aDCT)
270268
271269template class cExtractDir <tREAL4>;
272270
273- bool TestDirDCT (cNS_CodedTarget::cDCT & aDCT,cIm2D<tREAL4> anIm,double aRayCB , double size_factor , std::vector<cPt2di>& vec2plot){
271+ bool TestDirDCT (cNS_CodedTarget::cDCT & aDCT, cIm2D<tREAL4> anIm, double ray_min , double ray_max , std::vector<cPt2di>& vec2plot){
274272
275273
274+ /*
276275 double max_possible_x = std::min(aDCT.Pix().x(), anIm.DIm().Sz().x()-aDCT.Pix().x());
277276 double max_possible_y = std::min(aDCT.Pix().y(), anIm.DIm().Sz().y()-aDCT.Pix().y());
278277 double max_possible = std::min(max_possible_x, max_possible_y);
279278 double max_ray = std::min(aRayCB*0.8*size_factor, max_possible-1);
279+ */
280280
281281 // StdOut() << max_possible_x << " " << max_possible_y << " " << max_possible << " " << max_ray << "\n";
282282
283- cExtractDir<tREAL4> anED (anIm,aRayCB*0.4 , max_ray);
284-
285-
283+ cExtractDir<tREAL4> anED (anIm, ray_min, ray_max);
286284
287285 bool Ok = anED.CalcDir (aDCT);
288286
0 commit comments