Skip to content

Commit

Permalink
New option in codetarget recognition to avoid error in multiple target
Browse files Browse the repository at this point in the history
  • Loading branch information
deseilligny committed Jun 10, 2024
1 parent f0cc142 commit 0197e01
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 59 deletions.
11 changes: 11 additions & 0 deletions MMVII/Doc/Methods/CodedTarget-Theory.tex
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
\chapter{Coded target}
\label{Chap:CodedTarget}

%-----------------------------------------------------------------------
%-----------------------------------------------------------------------
%-----------------------------------------------------------------------

\section{Todo}

\begin{itemize}
\item {\tt 2023-12-14-CurTestClino/Calib-1/Processing/} target partially occluded are recognized as others,
for example {\tt 043\_0078.JPG}, target {\tt 66 (?)} is interpreted as {\tt 34} ;
\end{itemize}


%-----------------------------------------------------------------------
%-----------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions MMVII/include/MMVII_ExtractLines.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef _MMVII_EXTRACT_LINES_H_
#define _MMVII_EXTRACT_LINES_H_

#include "MMVII_Image2D.h"
#include "MMVII_Interpolators.h"
#include "MMVII_Mappings.h"


namespace MMVII
Expand Down Expand Up @@ -264,6 +267,14 @@ class cScoreTetaLine : public tFunc1DReal // herit from tFunc1DReal for optimiza

/// extract the 2 angle of line in checkboar, aStepInit & aStepLim => used in cOptimByStep
std::pair<tREAL8,tREAL8> Tetas_CheckBoard(const cPt2dr& aC,tREAL8 aStepInit,tREAL8 aStepLim);

typedef tREAL8 t2Teta[2];
/// Assure that teta1->teta2 is trigo and teta1<Pi
static void NormalizeTeta(t2Teta &);

const tREAL8 & Length() const; ///< Accessor
cDataIm2D<tREAL4> * DIm() const; ///< Accessor

private :

/// fix center of reusing the data (to avoid cost for cTabulatedDiffInterpolator)
Expand Down
7 changes: 7 additions & 0 deletions MMVII/include/MMVII_Geom2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace MMVII
typedef cSegment<tREAL8,2> tSeg2dr;



/** \file MMVII_Geom2D.h
\brief contain classes for geometric manipulation, specific to 2D space :
2D line, 2D plane, rotation, ...
Expand Down Expand Up @@ -95,10 +96,16 @@ template <class Type> class cSegment2DCompiled : public cSegmentCompiled<Type,2>
Type Dist(const tPt& aPt) const; ///< Faster than upper class
const tPt & Normal() const {return mNorm;}


tPt InterSeg(const cSegment2DCompiled<Type> &,tREAL8 aMinAngle=1e-5,bool *IsOk=nullptr);
private :
tPt mNorm;
};

/** this class a represent a "closed" segment , it has same data than cSegment2DCompiled,
* but as a set/geometric primitive, it is limited by extremities
*/

class cClosedSeg2D
{
public :
Expand Down
37 changes: 20 additions & 17 deletions MMVII/src/Appli/cMMVII_Appli_MakeReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,29 @@ void cMMVII_Appli::DoMergeReport()
{
if (BoolFind(mReport2Merge,anIt.first))
{
cMMVII_Ofs aFileGlob(anIt.second, eFileModeOut::AppendText);
const std::string & anId = anIt.first;

int aNbLines = 0;
if (mRMSWasUsed)
{
for (const auto & aNameIm : VectMainSet(0))
{
std::string aNameIn = DirSubPReport(anId) + FileOfPath(aNameIm,false) + "." + mMapIdPostReport[anId];
cMMVII_Ifs aIn(aNameIn, eFileModeIn::Text);

std::string aLine;
while (std::getline(aIn.Ifs(), aLine))
// Put aFileGlob in {} to create destruction before OnCloseReport that may generat error
{
cMMVII_Ofs aFileGlob(anIt.second, eFileModeOut::AppendText);
const std::string & anId = anIt.first;

if (mRMSWasUsed)
{
for (const auto & aNameIm : VectMainSet(0))
{
aFileGlob.Ofs() << aLine<< "\n";
aNbLines++;
}
std::string aNameIn = DirSubPReport(anId) + FileOfPath(aNameIm,false) + "." + mMapIdPostReport[anId];
cMMVII_Ifs aIn(aNameIn, eFileModeIn::Text);

std::string aLine;
while (std::getline(aIn.Ifs(), aLine))
{
aFileGlob.Ofs() << aLine<< "\n";
aNbLines++;
}
}
}
}
RemoveRecurs(DirSubPReport(anId),false,false);
RemoveRecurs(DirSubPReport(anId),false,false);
}
OnCloseReport(aNbLines,anIt.first,anIt.second);
}
}
Expand Down
20 changes: 20 additions & 0 deletions MMVII/src/Bench/BenchGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,31 @@ void BenchMap2D()
void BenchPlane3D();
void BenchHomogr2D();

void BenchSeg2D()
{
for (int aK=0 ; aK<100 ; aK++)
{
cPt2dr aP1 = cPt2dr::PRandC();
cPt2dr aT1 = cPt2dr::PRandUnit();
cSegment2DCompiled<tREAL8> aSeg1(aP1,aP1+aT1);

cPt2dr aP2 = cPt2dr::PRandC();
cPt2dr aT2 = cPt2dr::PRandUnitNonAligned(aT1);
cSegment2DCompiled<tREAL8> aSeg2(aP2,aP2+aT2);

cPt2dr aI = aSeg1.InterSeg(aSeg2);

MMVII_INTERNAL_ASSERT_bench(aSeg1.DistLine(aI)<1e-8,"InterSeg");
MMVII_INTERNAL_ASSERT_bench(aSeg2.DistLine(aI)<1e-8,"InterSeg");
}
}

void BenchGeom(cParamExeBench & aParam)
{
if (! aParam.NewBench("Geom")) return;

BenchSeg2D();

BenchSampleQuat();

BenchHomogr2D();
Expand Down
Loading

0 comments on commit 0197e01

Please sign in to comment.