gradient of an image
Which function can be used to find the gradient of the gray scale image in openCV?
Maybe you could use Sobel derivatives
/// Gradient X
//Scharr( src_gray, grad_x, ddepth, 1, 0, scale, delta, BORDER_DEFAULT );
Sobel( src_gray, grad_x, ddepth, 1, 0, 3, scale, delta, BORDER_DEFAULT );
convertScaleAbs( grad_x, abs_grad_x );
/// Gradient Y
//Scharr( src_gray, grad_y, ddepth, 0, 1, scale, delta, BORDER_DEFAULT );
Sobel( src_gray, grad_y, ddepth, 0, 1, 3, scale, delta, BORDER_DEFAULT );
convertScaleAbs( grad_y, abs_grad_y );
You could use the official tutorial on using Sobel operators to get some more explanation about how it is working.
Asked: 2014-08-26 04:44:25 -0600
Seen: 264 times
Last updated: Aug 26 '14
Here is an example of Sobel operator which computes an approximation of the gradient of an image intensity function. http://docs.opencv.org/2.4.4/doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.html?highlight=sobel