Skip to content
Snippets Groups Projects
Commit 8279ceb7 authored by Jordi Inglada's avatar Jordi Inglada
Browse files

ENH: Added flag in order not to use the sign of the direction of the lines....

ENH: Added flag in order not to use the sign of the direction of the lines. Needed for the parallel line detection.
parent bd75d125
Branches
Tags
No related merge requests found
......@@ -67,6 +67,8 @@ class ITK_EXPORT LinkPathListFilter
itkGetMacro(AngularThreshold,RealType);
itkSetMacro(DistanceThreshold,RealType);
itkGetMacro(DistanceThreshold,RealType);
itkSetMacro(ModuloPI, bool);
itkGetMacro(ModuloPI, bool);
protected:
/** Constructor */
......@@ -104,6 +106,9 @@ private:
RealType m_AngularThreshold;
RealType m_DistanceThreshold;
/// Do not use the sign of the orientation of the lines
bool m_ModuloPI;
};
}// End namespace otb
......
......@@ -32,6 +32,7 @@ LinkPathListFilter<TPath>
{
m_DistanceThreshold = 10.;
m_AngularThreshold = 3.14;
m_ModuloPI = false;
}
template <class TPath>
......@@ -229,9 +230,18 @@ LinkPathListFilter<TPath>
double alpha2 = vcl_atan2((v4[1]-v3[1]),(v4[0]-v3[0]));
double alpha3 = vcl_atan2((v3[1]-v2[1]),(v3[0]-v2[0]));
alpha1 = (alpha1 >= 0)?alpha1:(alpha1+2.*M_PI);
alpha2 = (alpha2 >= 0)?alpha2:(alpha2+2.*M_PI);
alpha3 = (alpha3 >= 0)?alpha3:(alpha3+2.*M_PI);
if(m_ModuloPI)
{
alpha1 = (alpha1 >= 0)?alpha1:(alpha1+M_PI);
alpha2 = (alpha2 >= 0)?alpha2:(alpha2+M_PI);
alpha3 = (alpha3 >= 0)?alpha3:(alpha3+M_PI);
}
else
{
alpha1 = (alpha1 >= 0)?alpha1:(alpha1+2.*M_PI);
alpha2 = (alpha2 >= 0)?alpha2:(alpha2+2.*M_PI);
alpha3 = (alpha3 >= 0)?alpha3:(alpha3+2.*M_PI);
}
bool resp = (vcl_abs(alpha1-alpha2) < static_cast<double>(m_AngularThreshold))
&& (vcl_abs(alpha1-alpha3) < static_cast<double>(m_AngularThreshold))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment