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

Mise en commentaire dans PixelSuppression

parent 9dd9785a
No related branches found
No related tags found
No related merge requests found
...@@ -231,7 +231,7 @@ LocalHoughFilter<TInputImage> ...@@ -231,7 +231,7 @@ LocalHoughFilter<TInputImage>
m_HoughFilter->SetNumberOfLines( m_NumberOfLines ); m_HoughFilter->SetNumberOfLines( m_NumberOfLines );
m_HoughFilter->SetVariance( m_Variance ); m_HoughFilter->SetVariance( m_Variance );
m_HoughFilter->SetDiscRadius( m_DiscRadius ); m_HoughFilter->SetDiscRadius( m_DiscRadius );
//m_HoughFilter->SetThreshold( m_Threshold ); m_HoughFilter->SetThreshold( m_Threshold );
m_HoughFilter->Modified(); m_HoughFilter->Modified();
......
...@@ -43,48 +43,48 @@ PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::PixelSuppress ...@@ -43,48 +43,48 @@ PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::PixelSuppress
template <class TInputImage, class TOutputImage> template <class TInputImage, class TOutputImage>
void void
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage> PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::SetInputImage(const InputImageType *input) ::SetInputImage(const InputImageType *input)
{ {
this->SetInput(0,input); this->SetInput(0,input);
} }
template <class TInputImage, class TOutputImage> template <class TInputImage, class TOutputImage>
void void
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage> PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::SetInputImageDirection(const InputImageType *input) ::SetInputImageDirection(const InputImageType *input)
{ {
this->SetInput(1,input); this->SetInput(1,input);
} }
template <class TInputImage, class TOutputImage> template <class TInputImage, class TOutputImage>
const const
typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType * typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType *
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage> PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::GetInputImage(void) ::GetInputImage(void)
{ {
if (this->GetNumberOfInputs() < 1) if (this->GetNumberOfInputs() < 1)
{ {
return 0; return 0;
} }
return static_cast<const TInputImage * > return static_cast<const TInputImage * >
(this->GetInput(0) ); (this->GetInput(0) );
} }
template <class TInputImage, class TOutputImage> template <class TInputImage, class TOutputImage>
const const
typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType * typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType *
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage> PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::GetInputImageDirection(void) ::GetInputImageDirection(void)
{ {
if (this->GetNumberOfInputs() < 1) if (this->GetNumberOfInputs() < 1)
{ {
return 0; return 0;
} }
return static_cast<const TInputImage * > return static_cast<const TInputImage * >
(this->GetInput(1) ); (this->GetInput(1) );
} }
template <class TInputImage, class TOutputImage> template <class TInputImage, class TOutputImage>
...@@ -244,49 +244,59 @@ void PixelSuppressionByDirectionImageFilter< TInputImage, TOutputImage>::Threade ...@@ -244,49 +244,59 @@ void PixelSuppressionByDirectionImageFilter< TInputImage, TOutputImage>::Threade
continue; continue;
// Distance between pixel (x,y) and central pixel // Distance between pixel (x,y) and central pixel
DistanceXY = static_cast<double>(sqrt(x*x+y*y)); // DistanceXY = static_cast<double>(sqrt(x*x+y*y));
// If the pixel (x,y) is inside the circle of radius m_Radius // If the pixel (x,y) is inside the circle of radius m_Radius
if ( DistanceXY <= m_Radius[0] ) // if ( DistanceXY <= m_Radius[0] )
{ // {
// Rotation of the system axis in the direction of the central pixel (thetaXcYc) // // Rotation of the system axis in the direction of the central pixel (thetaXcYc)
// (x,y) -> (xt,yt) // // (x,y) -> (xt,yt)
TRANSITION_MATRIX( x, y, ThetaXcYc, xt, yt ); // TRANSITION_MATRIX( x, y, ThetaXcYc, xt, yt );
// The absolute value of yt/xt is used to bring back the pixel (xt,yt) // // The absolute value of yt/xt is used to bring back the pixel (xt,yt)
// in positive co-ordinates // // in positive co-ordinates
// => thetaxtyt is included in the interval [0;PI/2] // // => thetaxtyt is included in the interval [0;PI/2]
if ( xt != 0. ) // if ( xt != 0. )
Thetaxtyt = atan( fabs(yt/xt) ); // Thetaxtyt = atan( fabs(yt/xt) );
else // else
Thetaxtyt = M_PI/2.; // Thetaxtyt = M_PI/2.;
// Then, we test if the pixel is included in the interval [0;m_AngularBeam] // // Then, we test if the pixel is included in the interval [0;m_AngularBeam]
if ( (0. <= Thetaxtyt) and // if ( (0. <= Thetaxtyt) and
(Thetaxtyt <= m_AngularBeam) ) // (Thetaxtyt <= m_AngularBeam) )
{ // {
// The pixel is located in the direction of the central pixel // // The pixel is located in the direction of the central pixel
// Get the direction of the pixel (X,Y) in the image of diretions // // Get the direction of the pixel (X,Y) in the image of diretions
ThetaXY = static_cast<double>(bit.GetPixel(i)); // ThetaXY = static_cast<double>(bit.GetPixel(i));
// Angular tolerance on the direction of the central pixel // // Angular tolerance on the direction of the central pixel
MinThetaXcYc = ThetaXcYc - m_AngularBeam; // MinThetaXcYc = ThetaXcYc - m_AngularBeam;
MaxThetaXcYc = ThetaXcYc + m_AngularBeam; // MaxThetaXcYc = ThetaXcYc + m_AngularBeam;
// Test if the pixel belongs to a line // // Test if the pixel belongs to a line
if ( (MinThetaXcYc <= ThetaXY) and // if ( (MinThetaXcYc <= ThetaXY) &&
(ThetaXY <= MaxThetaXcYc ) ) // (ThetaXY <= MaxThetaXcYc ) )
IsLine = true; // IsLine = true;
// }
}
Thetaxtyt = atan2(y,x) - M_PI/2.0;
if(Thetaxtyt < 0)
Thetaxtyt = M_PI + Thetaxtyt;
// std::cout << sin(Thetaxtyt) << " " << sin(ThetaXcYc) << " " << sin(bit.GetPixel(i)) << std::endl;
if( (fabs(sin(Thetaxtyt-ThetaXcYc)) <= sin(m_AngularBeam)) && (fabs(sin(bit.GetPixel(i)-ThetaXcYc)) <= sin(m_AngularBeam)) )
IsLine = true;
// }
} }
} // end of the loop on the pixels of the region // end of the loop on the pixels of the region
// Assignment of this value to the output pixel // Assignment of this value to the output pixel
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment