Remove background color in image processing for OCR

前端 未结 6 2057
借酒劲吻你
借酒劲吻你 2021-02-01 10:50

I am trying to remove background color so as to improve the accuracy of OCR against images. A sample would look like below:

6条回答
  •  悲哀的现实
    2021-02-01 11:47

    In Imagemagick, you can use the -lat function to do that.

    convert image.jpg -colorspace gray -negate -lat 50x50+5% -negate result.jpg
    

    convert image.jpg -colorspace HSB -channel 2 -separate +channel \
    -white-threshold 35% \
    -negate -lat 50x50+5% -negate \
    -morphology erode octagon:1 result2.jpg
    

提交回复
热议问题