Pergunta

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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top