answered 2016-03-19 01:28:28 -0600
you need a grayscale image as input, not a color one.
Mat img=imread("G:/Capture.png", IMREAD_GRAYSCALE);