How to use Fred's ImageMagick textcleaner script?

馋奶兔 提交于 2019-12-23 03:02:12

问题


I want to do OCR on some of my images, but images are not quite very impressive. So, for cleaning it I wanted to use Fred's ImageMagick Textcleaner script. Command that I gave:-

sh textcleaner.sh input_file output_file -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20

This is the arguments which Fred has given on website itself. I am also doing for same sample image. But I don't think so any of my options are working everything is by default. And I keep getting this error also

textcleaner.sh: line 177: type: textcleaner.sh: not found
usage: dirname path
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]

And At last I had to keep the files in same folder where my textcleaner script is. How can I make it global and give the absolute path to it rather than putting the files wherever textcleaner is.


回答1:


It's a bash script - it says so in the first line - yet you are trying to run it in sh - which is not bash. You need to make the script executable, by running

chmod +x textcleaner

then you can run it properly using:

./textcleaner ... arguments ...

That should make the error message go away. Then try showing us a sample image so we can try and see what the problem is.




回答2:


In my ImageMagick scripts, the syntax is script name ...arguments... input output. So your command should be

bash textcleaner.sh -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 input_file output_file 


See my Pointers For Use (for further configuration) at my home page: http://www.fmwconcepts.com/imagemagick/index.php



来源:https://stackoverflow.com/questions/33411898/how-to-use-freds-imagemagick-textcleaner-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!