Skip to Main Content
Learning OpenCV
book

Learning OpenCV

by Gary Bradski, Adrian Kaehler
September 2008
Beginner to intermediate content levelBeginner to intermediate
580 pages
20h 7m
English
O'Reilly Media, Inc.
Content preview from Learning OpenCV

Gradients and Sobel Derivatives

One of the most basic and important convolutions is the computation of derivatives (or approximations to them). There are many ways to do this, but only a few are well suited to a given situation.

In general, the most common operator used to represent differentiation is the Sobel derivative [Sobel68] operator (see Figures Figure 6-3 and Figure 6-4). Sobel operators exist for any order of derivative as well as for mixed partial derivatives (e.g.,

image with no caption

).

The effect of the Sobel operator when used to approximate a first derivative in the x-dimension

Figure 6-3. The effect of the Sobel operator when used to approximate a first derivative in the x-dimension

cvSobel(
      const CvArr*  src,
      CvArr*        dst,
      int           xorder,
      int           yorder,
      int           aperture_size = 3
);

Here, src and dst are your image input and output, and xorder and yorder are the orders of the derivative. Typically you'll use 0, 1, or at most 2; a 0 value indicates no derivative in that direction. [65] The aperture_size parameter should be odd and is the width (and the height) of the square filter. Currently, aperture sizes of 1, 3, 5, and 7 are supported. If src is 8-bit then the dst must be of depth IPL_DEPTH_16S to avoid overflow.

The effect of the Sobel operator when used to approximate a first derivative in the y-dimension

Figure 6-4. The effect of the Sobel operator when used to approximate a first derivative ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning OpenCV 3

Learning OpenCV 3

Adrian Kaehler, Gary Bradski
Learning OpenCV, 2nd Edition

Learning OpenCV, 2nd Edition

Adrian Kaehler, Gary Bradski
Practical OpenCV

Practical OpenCV

Samarth Brahmbhatt
Machine Learning for OpenCV

Machine Learning for OpenCV

Michael Beyeler, Michael Beyeler (USD)

Publisher Resources

ISBN: 9780596516130Supplemental ContentErrata Page