How to use OpenCV to process image so that the text become sharp and clear?

前端 未结 2 1067
逝去的感伤
逝去的感伤 2021-01-30 14:52

Wanted to achieve something like this: http://www.leptonica.com/binarization.html

While searching for solutions, most of the answers were general instructions such as ad

2条回答
  •  不知归路
    2021-01-30 15:17

    Instead of using Imgproc.THRESH_BINARY_INV use Imgproc.THRESH_BINARY only as _INV is inverting your image after binarisations and resulted is the said output shown above in your example.

    correct code:

    Imgproc.adaptiveThreshold(imageMat, imageMat, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY, 5, 4);
    

提交回复
热议问题