21 #ifndef otbLineSegmentDetector_h
22 #define otbLineSegmentDetector_h
28 #include "itkUnaryFunctorImageFilter.h"
29 #include "itkGradientRecursiveGaussianImageFilter.h"
30 #include "itkGradientImageFilter.h"
42 template <
class TInputPixel,
class TOutputPixel>
43 class MagnitudeFunctor
48 return static_cast<TOutputPixel
>(2 * std::sqrt(input[0] * input[0] + input[1] * input[1]));
58 template <
class TInputPixel,
class TOutputPixel>
59 class OrientationFunctor
64 return static_cast<TOutputPixel
>(std::atan2(input[0], -input[1]));
91 template <
class TInputImage,
class TPrecision =
double>
111 typedef typename InputImageType::SizeType
SizeType;
171 using Superclass::SetInput;
179 return m_UsedPointImage;
183 return m_MagnitudeFilter->GetOutput();
187 return m_OrientationFilter->GetOutput();
233 virtual bool IsAligned(
double Angle,
double regionAngle,
double prec)
const;
254 virtual double NFA(
int n,
int k,
double p,
double logNT)
const;
260 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
287 #ifndef OTB_MANUAL_INSTANTIATION
This class represents a node of data in a vector data hierarchy.
This functor computes the magnitude of a covariant vector.
TOutputPixel operator()(const TInputPixel &input)
This functor computes the orientation of a cavariant vector Orientation values lies between 0 and 2*...
TOutputPixel operator()(const TInputPixel &input)
Creation of an "otb" image which contains metadata.
Superclass::PixelType PixelType
itk::SmartPointer< Self > Pointer
Superclass::SizeType SizeType
Superclass::IndexType IndexType
this class implement a fast line detector with false detection control using the a contrario method
otb::Image< unsigned char, 2 > LabelImageType
InputImageType::PointType OriginType
~LineSegmentDetector() override
virtual const InputImageType * GetInput(void)
virtual void SetInput(const InputImageType *input)
DirectionVectorType::iterator DirectionVectorIteratorType
MagnitudeFilterType::OutputImageType::PixelType MagnitudePixelType
IndexVectorType::iterator IndexVectorIteratorType
virtual void SetPixelToNotIni(InputIndexType index)
virtual bool IsNotUsed(InputIndexType &index) const
GradientFilterPointerType m_GradientFilter
itk::SmartPointer< Self > Pointer
VectorOfIndexVectorType m_RegionList
OrientationFilterType::Pointer OrientationFilterPointerType
virtual double ImproveRectangle(RectangleType &rectangle) const
std::vector< IndexVectorType > VectorOfIndexVectorType
virtual bool IsUsed(InputIndexType &index) const
OutputImageType::PixelType OutputPixelType
MagnitudeFilterType::OutputImageType MagnitudeImageType
virtual RectangleType Region2Rectangle(IndexVectorType region, double regionAngle)
MagnitudeImageType::Pointer MagnitudeImagePointerType
InputImageType::IndexType InputIndexType
virtual void SetPixelToUsed(InputIndexType index)
VectorDataType::DataNodeType DataNodeType
RectangleListType::iterator RectangleListTypeIterator
InputImageType::RegionType RegionType
void GenerateData() override
OutputImageType::IndexType OutputIndexType
InputImageType::PixelType InputPixelType
virtual int ComputeRectangles()
RectangleListType m_RectangleList
DirectionVectorType m_DirectionVector
virtual bool IsNotIni(InputIndexType &index) const
LabelImagePointerType m_UsedPointImage
virtual void CopyRectangle(RectangleType &rDst, RectangleType &rSrc) const
VectorDataType::LineType LineType
GradientFilterType::OutputImageType GradientOutputImageType
void operator=(const Self &)=delete
virtual double angle_diff(double a, double b) const
void GenerateInputRequestedRegion() override
unsigned int m_MinimumRegionSize
MagnitudeFilterType::Pointer MagnitudeFilterPointerType
RectangleType::iterator RectangleIteratorType
std::vector< double > RectangleType
virtual CoordinateHistogramType SortImageByModulusValue(MagnitudeImagePointerType modulusImage)
itk::UnaryFunctorImageFilter< GradientOutputImageType, OutputImageType, Functor::MagnitudeFunctor< typename GradientOutputImageType::PixelType, TPrecision > > MagnitudeFilterType
LineSegmentDetector(const Self &)=delete
LabelImagePointerType GetMap()
OrientationFilterType::OutputImageType OutputImageDirType
virtual double ComputeRegionOrientation(IndexVectorType region, double x, double y, double angleRegion) const
itk::SmartPointer< const Self > ConstPointer
InputImageType::SpacingType SpacingType
virtual bool IsAligned(double Angle, double regionAngle, double prec) const
GradientFilterType::Pointer GradientFilterPointerType
itk::GradientRecursiveGaussianImageFilter< OutputImageType > GradientFilterType
OutputImageType::SizeType OutputSizeType
OutputImageDirType::RegionType OutputImageDirRegionType
LabelImageType::Pointer LabelImagePointerType
MagnitudeImagePointerType GetGradMod()
Image< TPrecision, 2 > OutputImageType
CoordinateHistogramType::iterator CoordinateHistogramIteratorType
std::vector< IndexVectorType > CoordinateHistogramType
TInputImage InputImageType
LineType::VertexType VertexType
std::vector< RectangleType > RectangleListType
itk::UnaryFunctorImageFilter< GradientOutputImageType, OutputImageType, Functor::OrientationFunctor< typename GradientOutputImageType::PixelType, TPrecision > > OrientationFilterType
void PrintSelf(std::ostream &os, itk::Indent indent) const override
double m_DirectionsAllowed
MagnitudeFilterPointerType m_MagnitudeFilter
virtual void SetRegionToNotIni(IndexVectorType region)
VectorDataSource< VectorData< TPrecision > > Superclass
VectorDataType::PointType PointType
virtual bool GrowRegion(InputIndexType index, IndexVectorType ®ion, double ®ionAngle)
InputImageType::SizeType SizeType
VectorData< TPrecision > VectorDataType
virtual double NFA(int n, int k, double p, double logNT) const
virtual void LineSegmentDetection(CoordinateHistogramType &CoordinateHistogram)
OutputImageDirType::Pointer GetGradOri()
virtual double ComputeRectNFA(const RectangleType &rec) const
OrientationFilterPointerType m_OrientationFilter
std::vector< float > DirectionVectorType
std::vector< OutputIndexType > IndexVectorType
Filter hierarchy for generating VectorData.
This class represents a hierarchy of vector data.
typename DataNodeType::PointType PointType
typename DataNodeType::LineType LineType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.