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>>
97 this->SetRadius(radius);
105 void operator=(
const Self&);
111 #endif // otbSobelVectorImageFilter_h