I am working on a project that requires manipulating an image depending on the threshold value calculated by the otsu method using OpenCV. I require the threshold value calculated by Otsu method.
The problem is, according to
http://opencv.willowgarage.com/documentation/c/miscellaneous_image_transformations.html#threshold
it says that the threshold function returns the threshold value calculated using Otsu function, as a double when I use CV_THRESH_OTSU as the parameter for threshold type.
But when I run the code snippet
printf("thresh = %lf\n", cvThreshold(image, otsu, 100, 255, CV_THRESH_OTSU + CV_THRESH_BINARY_INV))
it throws an error “invalid use of void expression”.
How can I get the threshold value ?
Thanks in advance !
That documentation is for opencv v2.1 you seem to be using an older version, in opencv 0.9
cvThresholddoesn’t return a value: