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

前端 未结 2 1087
逝去的感伤
逝去的感伤 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:30

    Well, you're almost there. Just try these modifications:

    Instead of

        Imgproc.GaussianBlur(imageMat, imageMat, new Size(3, 3), 0);
    

    try:

         cvSmooth(imageMat, imageMat, CV_MEDIAN, new Size(3, 3), 0);
    

    check the syntax, may not exactly match

    The link you posted uses thresholding of Otsu, so try this:

     Imgproc.threshold(imageMat, imageMat, 0, 255, Imgproc.THRESH_OTSU);
    

    for thresholding.

    Try tweaking the parameters here and there, you should get something pretty close to your desired outcome.

提交回复
热议问题