Add a border to the image before processing (use copyMakeBorder), and remove it after processing.
OpenCV OTSU threshold removing text
Question
When I do an OTSU threshold on this image it always takes erodes away the same text every time no matter the lighting conditions.
Here is how I am calling the method:
threshold(outImg_gray(boxRoi), outImg_binarized(boxRoi), 0, 255, CV_THRESH_BINARY_INV|CV_THRESH_OTSU);
When given this image:
I get this image:
As you can see the bottom text removes part of the text at the bottom and it always removes part of this text.
How can I avoid this from happening?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow