iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Miscellaneous Image Filters

Miscellaneous Image filters

Functions

template<NRT_PROMOTE_PIX(double) >
Image< DestType > const nrt::centerSurround (Image< PixType > const center, Image< PixType > const surround, bool const rectify=false)
 Compute center-surround difference, returning the absolute value if rectify==true. More...
 
template<NRT_PROMOTE_PIX(double) >
Image< DestType > const nrt::orientedFilter (Image< PixType > const src, float const k, float const theta, float const intensity=1.0, bool const fastMath=false)
 Oriented filter along theta (deg), spatial freq k. More...
 
template<NRT_PROMOTE_PIX(double) >
std::tuple< Image< DestType >
, Image< DestType > > const 
nrt::sobelFilter3 (Image< PixType > const src, ConvolutionBoundaryStrategy strategy=nrt::ConvolutionBoundaryStrategy::REPLICATE)
 Filter the Image with a 3x3 Sobel edge-detecting filter. More...
 
template<NRT_PROMOTE_PIX(double) >
std::tuple< Image< DestType >
, Image< DestType > > const 
nrt::sobelFilter5 (Image< PixType > const src, ConvolutionBoundaryStrategy strategy=nrt::ConvolutionBoundaryStrategy::REPLICATE)
 Filter the Image with a 5x5 Sobel edge-detecting filter. More...
 
template<NRT_PROMOTE_PIX(double) >
Image< DestType > const nrt::integralImage (Image< PixType > const src)
 Compute an integral image. More...
 
template<NRT_PROMOTE_PIX(double) >
Image< DestType > const nrt::integralSquaresImage (Image< PixType > const src)
 Compute an integral squares image. More...
 
template<class PixType >
Image< PixType > nrt::median3x (Image< PixType > const &in)
 Apply a 3-point median filter in the x direction. More...
 
template<class PixType >
Image< PixType > nrt::median3y (Image< PixType > const &in)
 Apply a 3-point median filter in the y direction. More...
 
template<class PixType >
Image< PixType > nrt::median3 (Image< PixType > const &in, bool go_x=true, bool go_y=true)
 Apply a 3-point median filter in the x and/or y directions;. More...
 

Function Documentation

template<NRT_PROMOTE_PIX(double) >
Image<DestType> const nrt::centerSurround ( Image< PixType > const  center,
Image< PixType > const  surround,
bool const  rectify = false 
)

Compute center-surround difference, returning the absolute value if rectify==true.

The center-surround difference is computed as by subtracting a low resolution (surround) image from a high resolution (center) image.

Parameters
centerthe image from which center pixels will be taken (fine scale)
surroundthe image with the surround pixels (coarse scale)
rectifyIf true, the absolute value of the difference is returned (otherwise, negative values are clamped to zero)
Returns
An Image holding the difference between the center and the surround. Its dims will be the same as center.dims()
Note
center and surround sizes must be integer multiples.
template<NRT_PROMOTE_PIX(double) >
Image<DestType> const nrt::orientedFilter ( Image< PixType > const  src,
float const  k,
float const  theta,
float const  intensity = 1.0,
bool const  fastMath = false 
)

Oriented filter along theta (deg), spatial freq k.

This filter works on the difference between the image and itself low-passed. It modulates this difference by a complex sinusoid, and then low-passes the real and imaginary parts, and finally takes the modulus. This method is by Greenspan et al. (1994). CAUTION: you must provide as input (i.e., in "this") the difference between an image and itself low-pass filtered. CAUTION: results are possibly bad with the integer versions. Use float.

Parameters
srcsource Image
kspatial frequency
thetaangle in degrees
intensityintensity factor
fastMathWhether to use trig lookup tables internally to get sin and cos values. This may give up to a 2x speedup, at the cost of some minor loss of precision
Todo:

Make the CMake checks to define NRT_HAVE_ASM_FSINCOS and NRT_HAVE_SINCOS

Reconsider the parameter name fastMath if SINCOS is comparably fast to the lookups

template<NRT_PROMOTE_PIX(double) >
std::tuple<Image<DestType>, Image<DestType> > const nrt::sobelFilter3 ( Image< PixType > const  src,
ConvolutionBoundaryStrategy  strategy = nrt::ConvolutionBoundaryStrategy::REPLICATE 
)

Filter the Image with a 3x3 Sobel edge-detecting filter.

Returns
A tuple where the first element is a map of the edge magnitudes, and the second element is a map of the edge orientations (in radians)

This method will produce the orientation and magnitude of edges at every pixel of the input Image. See http://en.wikipedia.org/wiki/Sobel_operator for details.

Example:

Image<PixRGB<byte>> inputImage = readImage("myImage.jpg").convertTo<PixRGB<byte>>();
Image<PixRGB<float>> magnitude, orientation;
std::tie(magnitude, orientation) = sobelFilter3(inputImage);
See Also
sobelFilter5()
template<NRT_PROMOTE_PIX(double) >
std::tuple<Image<DestType>, Image<DestType> > const nrt::sobelFilter5 ( Image< PixType > const  src,
ConvolutionBoundaryStrategy  strategy = nrt::ConvolutionBoundaryStrategy::REPLICATE 
)

Filter the Image with a 5x5 Sobel edge-detecting filter.

See Also
sobelFilter3()
template<NRT_PROMOTE_PIX(double) >
Image<DestType> const nrt::integralImage ( Image< PixType > const  src)

Compute an integral image.

Note
The resulting image from this function has same dims as the original (as opposed to OpenCV's version which adds one to the dims).
template<NRT_PROMOTE_PIX(double) >
Image<DestType> const nrt::integralSquaresImage ( Image< PixType > const  src)

Compute an integral squares image.

Note
The resulting image from this function has same dims as the original (as opposed to OpenCV's version which adds one to the dims).
template<class PixType >
Image<PixType> nrt::median3x ( Image< PixType > const &  in)

Apply a 3-point median filter in the x direction.

See Also
median3y() median3()
template<class PixType >
Image<PixType> nrt::median3y ( Image< PixType > const &  in)

Apply a 3-point median filter in the y direction.

See Also
median3x() median3()
template<class PixType >
Image<PixType> nrt::median3 ( Image< PixType > const &  in,
bool  go_x = true,
bool  go_y = true 
)

Apply a 3-point median filter in the x and/or y directions;.

See Also
median3x() median3y()