# 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

This forum is disabled, please visit https://forum.opencv.org

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 -0600
**

Seen: **711 times**

Last updated: **Feb 07 '13**

Weird result while finding angle

Sobel derivatives in the 45 and 135 degree direction

High-level implementation of Canny

fingerprint orientation map through gradient method - opencv c++

Sobel filter doesn't respect ROI

Sobel filter output from opencv and Matlab different

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