Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the question might be a bit unclear, but i guess, you wanted the gradient, as in : "angles" and "magnitude", which might be achieved using 2 Sobel calls and cartToPolar

Mat img = ...
cvtColor(img, img, COLOR_BGR2GRAY);

Mat dx, dy; // 1st derivative in x,y
Sobel(img, dx, CV_32F, 1,0);
Sobel(img, dx, CV_32F, 0,1);

Mat angle, mag;
cartToPolar(dx, dy, mag, angle);