# Sobel function argument

Hi All,

Im new to OpenCV and I'm trying for the past hour to understand what is the scale and delta input argument to cv::Sober function.

Can anyone help me?

Thank u in advance

Sobel function argument

Hi All,

Im new to OpenCV and I'm trying for the past hour to understand what is the scale and delta input argument to cv::Sober function.

Can anyone help me?

Thank u in advance

add a comment

3

Documentation of Sobel function is prety clear on this:

"scale – optional scale factor for the computed derivative values; by default, no scaling is applied."

"delta – optional delta value that is added to the results prior to storing them in dst."

The reason why those arguments are part of the function is that type of image that stores the derivative may not be enough for whole range of values. For example: assume you are calculating derivative of CV_8U image with default kernel size. Resulting values of derivatives will be in range between -1024 and 1024. You may want (for various reasons) to stores derivatives in image of the same type, i.e. CV_8U. This means that all negative values will be cropped to 0, and all values above 255 will be cropped to 255. To pervent this crop you may set scale to 0.125 and delta to 128, so that all results will fall in range between 0 and 255.

You should check the kernel that is used. 3x3 Sobel kernel is [[-1, -2, -1], [0, 0, 0], [1, 2, 1]]. Maximum value for it will be 1 * 255 + 2 * 255 + 1 * 255 = 1020. And minimum value is -1 * 255 - 2 * 255 - 1 * 255 = - 1020.

Asked: **
2013-02-06 16:26:30 -0500
**

Seen: **374 times**

Last updated: **Feb 07 '13**

High-level implementation of Canny

gradient orientation for 0-180 histogram bins in opencv 2.4.9 visual studio 2013

How can I modify the edge detection method for the HoughCircles function?

Barcode recognition, Sobel derivatives and image transformation problem!

What is the OpenCv equivalent of this Matlab code for sobel edge detection?

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.