OpenCV Sobel Filter. More...
#include <ossimOpenCVSobelFilter.h>
Public Member Functions | |
| ossimOpenCVSobelFilter (ossimObject *owner=NULL) | |
| ossimOpenCVSobelFilter (ossimImageSource *inputSource, int xorder=1, int yorder=1, int aperture_size=3) | |
| ossimOpenCVSobelFilter (ossimObject *owner, ossimImageSource *inputSource, int xorder=1, int yorder=1, int aperture_size=3) | |
| ossimString | getShortName () const |
| ossimString | getLongName () const |
|
virtual ossimRefPtr < ossimImageData > | getTile (const ossimIrect &tileRect, ossim_uint32 resLevel=0) |
| virtual void | initialize () |
| virtual ossimScalarType | getOutputScalarType () const |
| ossim_uint32 | getNumberOfOutputBands () const |
| virtual bool | saveState (ossimKeywordlist &kwl, const char *prefix=0) const |
| virtual bool | loadState (const ossimKeywordlist &kwl, const char *prefix=0) |
Protected Member Functions | |
| void | runUcharTransformation (ossimImageData *tile) |
Protected Attributes | |
| ossimRefPtr< ossimImageData > | theTile |
| Output tile. | |
| int | theXOrder |
| Order of the derivative of x. | |
| int | theYOrder |
| Order of the derivative of y. | |
| int | theApertureSize |
| Size of the extended Soble kernel, must be 1, 3, 5 or 7. | |
OpenCV Sobel Filter.
Calculates the first, second, third or mixed image derivatives using an extended Sobel operator.
| xorder | Order of the derivative x | |
| yorder | Order of the derivative y | |
| aperture_size | Size of the extended Sobel kernel, must be 1, 3, 5 or 7 |
In all cases except 1, an
separable kernel will be used to calculate the derivative. For
a
or
a kernel is used (Gaussian smoothing is not done). There is also the special value CV_SCHARR (-1) that corresponds to a
Scharr filter that may give more accurate results than a
Sobel. Scharr aperture is

for the x-derivative or transposed for the y-derivative.
The function calculates the image derivative by convolving the image with the appropriate kernel:

The Sobel operators combine Gaussian smoothing and differentiation so the result is more or less resistant to the noise. Most often, the function is called with (xorder = 1, yorder = 0, apertureSize = 3) or (xorder = 0, yorder = 1, apertureSize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of:
![$ \left[ \begin{array}{ccc} -1 & 0 & 1 \\ -2 & 0 & 2 \\ 1 & 2 & 1 \\ \end{array} \right] $](form_14.png)
and the second one corresponds to a kernel of:
![$ \left[ \begin{array}{ccc} -1 & -2 & -1 \\ 0 & 0 & 0 \\ 1 & 2 & 1 \\ \end{array} \right] $](form_16.png)
or a kernel of:
![$ \left[ \begin{array}{ccc} 1 & 2 & 1 \\ 0 & 0 & 0 \\ -1 & -2 & -1 \\ \end{array} \right] $](form_17.png)
depending on the image origin (origin field of IplImage structure). Besides 8-bit images the function can process 32-bit floating-point images. Both the source and the destination must be single-channel images of equal size or equal ROI size.
| bool ossimOpenCVSobelFilter::loadState | ( | const ossimKeywordlist & | kwl, | |
| const char * | prefix = 0 | |||
| ) | [virtual] |
Method to the load (recreate) the state of an object from a keyword list. Return true if ok or false on error.
1.6.1