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>
m_HoughFilter->SetNumberOfLines( m_NumberOfLines );
m_HoughFilter->SetVariance( m_Variance );
m_HoughFilter->SetDiscRadius( m_DiscRadius );
//m_HoughFilter->SetThreshold( m_Threshold );
m_HoughFilter->SetThreshold( m_Threshold );
m_HoughFilter->Modified();
......
......@@ -43,48 +43,48 @@ PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::PixelSuppress
template <class TInputImage, class TOutputImage>
void
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::SetInputImage(const InputImageType *input)
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::SetInputImage(const InputImageType *input)
{
this->SetInput(0,input);
}
}
template <class TInputImage, class TOutputImage>
void
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::SetInputImageDirection(const InputImageType *input)
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::SetInputImageDirection(const InputImageType *input)
{
this->SetInput(1,input);
}
template <class TInputImage, class TOutputImage>
template <class TInputImage, class TOutputImage>
const
typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType *
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::GetInputImage(void)
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast<const TInputImage * >
(this->GetInput(0) );
}
template <class TInputImage, class TOutputImage>
typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType *
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::GetInputImage(void)
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast<const TInputImage * >
(this->GetInput(0) );
}
template <class TInputImage, class TOutputImage>
const
typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType *
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::GetInputImageDirection(void)
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast<const TInputImage * >
(this->GetInput(1) );
typename PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>::InputImageType *
PixelSuppressionByDirectionImageFilter<TInputImage, TOutputImage>
::GetInputImageDirection(void)
{
if (this->GetNumberOfInputs() < 1)
{
return 0;
}
return static_cast<const TInputImage * >
(this->GetInput(1) );
}
template <class TInputImage, class TOutputImage>
......@@ -244,49 +244,59 @@ void PixelSuppressionByDirectionImageFilter< TInputImage, TOutputImage>::Threade
continue;
// 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 ( DistanceXY <= m_Radius[0] )
{
// if ( DistanceXY <= m_Radius[0] )
// {
// Rotation of the system axis in the direction of the central pixel (thetaXcYc)
// (x,y) -> (xt,yt)
TRANSITION_MATRIX( x, y, ThetaXcYc, xt, yt );
// // Rotation of the system axis in the direction of the central pixel (thetaXcYc)
// // (x,y) -> (xt,yt)
// TRANSITION_MATRIX( x, y, ThetaXcYc, xt, yt );
// The absolute value of yt/xt is used to bring back the pixel (xt,yt)
// in positive co-ordinates
// => thetaxtyt is included in the interval [0;PI/2]
if ( xt != 0. )
Thetaxtyt = atan( fabs(yt/xt) );
else
Thetaxtyt = M_PI/2.;
// // The absolute value of yt/xt is used to bring back the pixel (xt,yt)
// // in positive co-ordinates
// // => thetaxtyt is included in the interval [0;PI/2]
// if ( xt != 0. )
// Thetaxtyt = atan( fabs(yt/xt) );
// else
// Thetaxtyt = M_PI/2.;
// Then, we test if the pixel is included in the interval [0;m_AngularBeam]
if ( (0. <= Thetaxtyt) and
(Thetaxtyt <= m_AngularBeam) )
{
// The pixel is located in the direction of the central pixel
// Get the direction of the pixel (X,Y) in the image of diretions
ThetaXY = static_cast<double>(bit.GetPixel(i));
// // Then, we test if the pixel is included in the interval [0;m_AngularBeam]
// if ( (0. <= Thetaxtyt) and
// (Thetaxtyt <= m_AngularBeam) )
// {
// // The pixel is located in the direction of the central pixel
// // Get the direction of the pixel (X,Y) in the image of diretions
// ThetaXY = static_cast<double>(bit.GetPixel(i));
// Angular tolerance on the direction of the central pixel
MinThetaXcYc = ThetaXcYc - m_AngularBeam;
MaxThetaXcYc = ThetaXcYc + m_AngularBeam;
// // Angular tolerance on the direction of the central pixel
// MinThetaXcYc = ThetaXcYc - m_AngularBeam;
// MaxThetaXcYc = ThetaXcYc + m_AngularBeam;
// Test if the pixel belongs to a line
if ( (MinThetaXcYc <= ThetaXY) and
(ThetaXY <= MaxThetaXcYc ) )
// // Test if the pixel belongs to a line
// if ( (MinThetaXcYc <= ThetaXY) &&
// (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
......
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