Applying a threshold on an image in order to create a binary image could be a good way to extract the meaningful elements of an image. Suppose that you have the following image of a book:
Since you are interested in analyzing the text in this image, you apply a threshold to this image, as follows:
// using a fixed threshold cv::Mat binaryFixed; cv::threshold(image,binaryFixed,70,255,cv::THRESH_BINARY);
You obtain the following result:
In fact, no matter what value you choose for the threshold, in some parts of the image, ...