Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.25 and delta to 128, so that all results will fall in range between 0 and 255.

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.25 0.125 and delta to 128, so that all results will fall in range between 0 and 255.