Hello
I am scanning a library card catalogue and there has been a problem with the scanner. The result has been that the card has been scanned but it is a small part of the resulting scanned image.
To further complicate matters the card does not always appear in the same spot in the scanned image.
The problem we have is that we are aiming to run these through an OCR so that we can produce a text file. When i have attempted to run them through an OCR the results are rubbish. If i manually remove the unwanted area and then re read them the resulting text file is far better.
I don't really want to re scan the cards if i can help it so was wondering is there are any ways i can remove the unwanted areas in batch mode using imagemagick.
The background is not a uniform colour, it is generally darker than the card image, which is almost always white, with a few blue and purple cards thrown in.
Any ideas? Or do i go back to the scanner and try and sort out why it is producing the images this way?
Removing the background
-
- Posts: 2
- Joined: 2015-07-07T04:30:48-07:00
- Authentication code: 1151
Re: Removing the background
I would recommend linking to at least one image as you will not get any useful response until people can view and try one.
The imagemagick version as well as the platform/operating system information would also be useful.
The imagemagick version as well as the platform/operating system information would also be useful.
-
- Posts: 2
- Joined: 2015-07-07T04:30:48-07:00
- Authentication code: 1151
Re: Removing the background
Hi Bonzo
Thanks
An example can be seen here: https://drive.google.com/file/d/0BxcyzL ... sp=sharing
I am using Ubuntu 12.04.4
Imagemagick version 6.6.9
Thanks
An example can be seen here: https://drive.google.com/file/d/0BxcyzL ... sp=sharing
I am using Ubuntu 12.04.4
Imagemagick version 6.6.9
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Removing the background
Try:
Code: Select all
convert image_-009.jpg -fill White -fuzz 60% -draw "color 0,0 floodfill" -fuzz 5% -trim -contrast-stretch 1%,50% x.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Removing the background
I think you should be able to do the same command using mogrify to process every image in a folder. Make a new folder, say folder2 to hold the output. Assume your images are in folder1.
This will process every jpg file in your folder1 and make the same named image in folder2 as png
see http://www.imagemagick.org/Usage/basics/#mogrify
Code: Select all
cd folder1
mogrify -path pathto/folder2 -format png -fill White -fuzz 60% -draw "color 0,0 floodfill" -fuzz 5% -trim -contrast-stretch 1%,50% *.jpg
see http://www.imagemagick.org/Usage/basics/#mogrify