21 #ifndef otbSobelVectorImageFilter_h
22 #define otbSobelVectorImageFilter_h
26 #include <vnl/vnl_math.h>
38 template <
class TInput,
class TOutput>
51 unsigned int length = input.GetPixel(0).Size();
52 TOutput output(length);
53 for (
unsigned int i = 0; i < length; ++i)
55 double hori =
static_cast<double>((input.GetPixel(0)[i] - input.GetPixel(2)[i]) + 2 * (input.GetPixel(3)[i] - input.GetPixel(5)[i]) +
56 (input.GetPixel(6)[i] - input.GetPixel(8)[i]));
57 double vert =
static_cast<double>((input.GetPixel(0)[i] - input.GetPixel(6)[i]) + 2 * (input.GetPixel(1)[i] - input.GetPixel(7)[i]) +
58 (input.GetPixel(2)[i] - input.GetPixel(8)[i]));
60 output[i] =
static_cast<typename TOutput::ValueType
>(std::sqrt(std::pow(hori, 2.) + std::pow(vert, 2.)));
73 template <
class TInputImage,
class TOutputImage>
76 TInputImage, TOutputImage, Functor::SobelOperator<typename itk::ConstNeighborhoodIterator<TInputImage>, typename TOutputImage::PixelType>>
98 this->SetRadius(radius);
Performs the calculation of Sobel derivation.
TOutput operator()(const TInput &input)
Implements the Sobel Gradient to be processed on a vector image.
SobelVectorImageFilter(const Self &)
UnaryFunctorNeighborhoodVectorImageFilter< TInputImage, TOutputImage, Functor::SobelOperator< typename itk::ConstNeighborhoodIterator< TInputImage >, typename TOutputImage::PixelType > > Superclass
void operator=(const Self &)
itk::SmartPointer< const Self > ConstPointer
~SobelVectorImageFilter() override
SobelVectorImageFilter Self
itk::SmartPointer< Self > Pointer
Implements neighborhood-wise generic operation of one vector image.
NeighborhoodIteratorType::RadiusType RadiusType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.