开发者

Create a bitonal image for OCR using Image Magick

nice /usr/local/bin/convert \
  -colors 2 \
  -colorspace gray \
  -compress group4 \
   /var/www/html/uploads/pokemon.jpg \
   /var/www/html/uploads/pokemontest.jpg

This command worked with a really OLD version of Image Magick.

With the newest version this method produces a completely black image.

nice /usr/local/bin/convert \
  -colorspace gray \
  -compress group4 \
   /var/开发者_如何学JAVAwww/html/uploads/pokemon.jpg \
   /var/www/html/uploads/pokemontest.jpg

nice /usr/local/bin/convert \
   -colors 2 \
    /var/www/html/uploads/pokemontest.jpg \
    /var/www/html/uploads/pokemontestfinal.jpg

This results in a bitonal gray and black image, but it's really rough. NOT clean at all.


You could try a simple

convert  input.jpg  -threshold 50%  output.jpg

(and play a bit with variations of the 50% setting) and see if this gets you any further.

Also, you may want to have a look at these answers:

  • Image Preprocessing steps to improve the recognition rate
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜