Skip to content
Snippets Groups Projects
Commit 96e01c1e authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH: A method prototype modification in...

ENH: A method prototype modification in LSDCode/FeatureExtraction/otbLineSegmentDetector.txx Code/FeatureExtraction/otbLineSegmentDetector.h
parent 93bfaf92
No related branches found
No related tags found
No related merge requests found
...@@ -204,7 +204,7 @@ protected: ...@@ -204,7 +204,7 @@ protected:
virtual float ComputeRectNFA(RectangleType rec); virtual float ComputeRectNFA(RectangleType rec);
/** */ /** */
virtual float ImproveRectangle(RectangleType * rec , float NFA); virtual float ImproveRectangle(RectangleType * rec);
/** NFA For a rectangle*/ /** NFA For a rectangle*/
virtual float NFA(int n, int k, double p, double logNT); virtual float NFA(int n, int k, double p, double logNT);
......
...@@ -83,7 +83,7 @@ LineSegmentDetector<TInputImage,TPrecision > ...@@ -83,7 +83,7 @@ LineSegmentDetector<TInputImage,TPrecision >
/** Compute the modulus and the orientation gradient image*/ /** Compute the modulus and the orientation gradient image*/
m_GradientFilter->SetInput(this->GetInput()); m_GradientFilter->SetInput(this->GetInput());
m_GradientFilter->SetSigma(2.); m_GradientFilter->SetSigma(1.4);
m_MagnitudeFilter->SetInput(m_GradientFilter->GetOutput()); m_MagnitudeFilter->SetInput(m_GradientFilter->GetOutput());
m_OrientationFilter->SetInput(m_GradientFilter->GetOutput()); m_OrientationFilter->SetInput(m_GradientFilter->GetOutput());
...@@ -239,8 +239,7 @@ LineSegmentDetector<TInputImage, TPrecision> ...@@ -239,8 +239,7 @@ LineSegmentDetector<TInputImage, TPrecision>
RectangleListTypeIterator itRec = m_RectangleList.begin(); RectangleListTypeIterator itRec = m_RectangleList.begin();
while(itRec != m_RectangleList.end()) while(itRec != m_RectangleList.end())
{ {
float NFA = this->ComputeRectNFA(*itRec); float NFA = this->ImproveRectangle(&(*itRec) );
NFA = this->ImproveRectangle(&(*itRec) , NFA);
/** /**
* Here we start building the OUTPUT :a LineSpatialObjectList. * Here we start building the OUTPUT :a LineSpatialObjectList.
*/ */
...@@ -296,7 +295,7 @@ LineSegmentDetector<TInputImage, TPrecision> ...@@ -296,7 +295,7 @@ LineSegmentDetector<TInputImage, TPrecision>
template <class TInputImage, class TPrecision > template <class TInputImage, class TPrecision >
float float
LineSegmentDetector<TInputImage, TPrecision> LineSegmentDetector<TInputImage, TPrecision>
:: ImproveRectangle(RectangleType * rec , float NFA) :: ImproveRectangle(RectangleType * rec)
{ {
int n = 0; int n = 0;
float nfa_new; float nfa_new;
...@@ -304,6 +303,8 @@ LineSegmentDetector<TInputImage, TPrecision> ...@@ -304,6 +303,8 @@ LineSegmentDetector<TInputImage, TPrecision>
float delta_2 = delta / 2.0; float delta_2 = delta / 2.0;
RectangleType r; RectangleType r;
float NFA = this->ComputeRectNFA(*rec);
if( NFA > 0. ) return NFA; if( NFA > 0. ) return NFA;
/*Try to improve the precison of the oriented */ /*Try to improve the precison of the oriented */
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "otbLocalHoughFilter.h" #include "otbLocalHoughFilter.h"
#include "otbFillGapsFilter.h" #include "otbFillGapsFilter.h"
#include "otbDrawLineSpatialObjectListFilter.h" #include "otbDrawLineSpatialObjectListFilter.h"
#include "otbLineSegmentDetector.h"
#include "itkRescaleIntensityImageFilter.h" #include "itkRescaleIntensityImageFilter.h"
#include "otbLineSpatialObjectList.h" #include "otbLineSpatialObjectList.h"
...@@ -111,7 +112,10 @@ int main( int argc, char * argv[] ) ...@@ -111,7 +112,10 @@ int main( int argc, char * argv[] )
InternalImageType > DetectorType; InternalImageType > DetectorType;
typedef otb::PixelSuppressionByDirectionImageFilter< InternalImageType, typedef otb::PixelSuppressionByDirectionImageFilter< InternalImageType,
InternalImageType > PixelSuppressionType; InternalImageType > PixelSuppressionType;
typedef otb::LocalHoughFilter< InternalImageType > LocalHoughType; //typedef otb::LocalHoughFilter< InternalImageType > LocalHoughType;
typedef otb::LineSegmentDetector<InternalImageType, InternalPixelType> LocalHoughType;
typedef otb::FillGapsFilter FillGapsType; typedef otb::FillGapsFilter FillGapsType;
typedef otb::DrawLineSpatialObjectListFilter< InternalImageType, typedef otb::DrawLineSpatialObjectListFilter< InternalImageType,
OutputImageType > DrawLineListType; OutputImageType > DrawLineListType;
...@@ -196,7 +200,7 @@ int main( int argc, char * argv[] ) ...@@ -196,7 +200,7 @@ int main( int argc, char * argv[] )
rescaler->SetInput(pixelSuppression->GetOutput() ); rescaler->SetInput(pixelSuppression->GetOutput() );
localHough->SetInput( rescaler->GetOutput() ); localHough->SetInput( pixelSuppression->GetOutput() );
fillGaps->SetInput ( localHough->GetOutput() ); fillGaps->SetInput ( localHough->GetOutput() );
...@@ -243,12 +247,12 @@ int main( int argc, char * argv[] ) ...@@ -243,12 +247,12 @@ int main( int argc, char * argv[] )
pixelSuppression->SetRadius( PixelSuppressionRadius ); pixelSuppression->SetRadius( PixelSuppressionRadius );
pixelSuppression->SetAngularBeam( PixelSuppressionAngularBeam ); pixelSuppression->SetAngularBeam( PixelSuppressionAngularBeam );
PixelSuppressionType::SizeType LocalHoughRadius; //PixelSuppressionType::SizeType LocalHoughRadius;
LocalHoughRadius[0] = LocalHoughRadiusX; //LocalHoughRadius[0] = LocalHoughRadiusX;
LocalHoughRadius[1] = LocalHoughRadiusY; //LocalHoughRadius[1] = LocalHoughRadiusY;
localHough->SetRadius( LocalHoughRadius ); //localHough->SetRadius( LocalHoughRadius );
localHough->SetNumberOfLines( LocalHoughNumberOfLines ); //localHough->SetNumberOfLines( LocalHoughNumberOfLines );
fillGaps->SetRadius( FillGapsRadius ); fillGaps->SetRadius( FillGapsRadius );
fillGaps->SetAngularBeam( FillGapsAngularBeam ); fillGaps->SetAngularBeam( FillGapsAngularBeam );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment