Sobel using dx=1, dy=0 gives exactly same output as dx=0, dy=1 (bug?)
Greetings,
this piece of code seems to be generating exactly same Sobel gradients for dx=1, dy=0 and dx=0, dy=1. This means I can't subtract gradY from gradX because that leaves me with a black image. Is this a bug in OpenCV?
Mat gradX = new Mat();
Mat gradY = new Mat();
Mat gray = new Mat();
Mat gradient = new Mat()
Imgproc.cvtColor( cameraSnapshotFrame, gray, COLOR_BGR2GRAY );
Imgproc.Sobel( gray, gradX, CV_32F, 1, 0, -1, 1.0, 0 );
Imgproc.Sobel( gray, gradY, CV_32F, 0, 1, -1, 1.0, 0 ); // for some reason this gives the same result as the line above
Core.subtract( gradX, gradY, gradient );
Core.convertScaleAbs( gradient, gradient ); // gradient is an empty black image
Using OpenCV for Android version 3.1.0. Please help.
"... leaves me with a black image." -- small values might not be visible to a human. try:
too see, if it's really all 0