Ask Your Question

Revision history [back]

Maybe the issue is with how you're calculating the Sobel gradients. Try this .

cv::Mat Gx, Gy;
cv::Sobel(img, Gx, CV_64F, 1, 0, ksize);
cv::Sobel(img, Gy, CV_64F, 0, 1, ksize);

where ksize is the size of the Sobel kernel. (in your case, ksize = 3)