Domanda

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:

enter image description here

I get this image:

enter image description here

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?

È stato utile?

Soluzione

Add a border to the image before processing (use copyMakeBorder), and remove it after processing.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top