I recently downloaded imageMagick for windows and so far I find it awesome. I just followed a few tutorials to batch crop and rotate and it worked so fast. I had no idea a command line program could be so good!
I don’t know how difficult this is for a newbie, but is there a way I can automatically remove fingers from scans and replace with the page background colour?
I have the ScanSnap SV600 scanner and backup a lot of books. I suppose I have scanned about 50 books so far, so this comes to many pages. I know I could use glass to flatten down the pages, but I tend to just use fingers for speed. My fingers often appear in different locations on the page, depending on how I need to flatten the page down. This means, it is not possible to pinpoint the exact position of the finger by coordinates.
What I thought might work is I have started wearing coloured gloves for scans. Is there a way for imageMagick to recognise the colour and shape of the glove fingers and replace them with the page background colour? Please see the example scans uploaded.
Does anyone have a script that will do such a thing? Or is this even possible in ImageMagick or feasible for a Newbie? If imagemagick can’t do this or it is too difficult, are there any commercial software solutions that can, as I would be prepared to pay for a solution that works.
removing fingers from scans
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: removing fingers from scans
It is possible, but not trivial. The fingers also have shadows. A possible approach:
1. Find the finger.
2. Make those pixels transparent.
3. Fill the holes, with my "fill holes by priority".
Step (1) is not easy, because there is printing on the pages the same colour as the glove. You could isolate all pixels of approximately that colour (or just that hue). Eliminate components not at the edge of the image. The largest remaining component is a finger.
1. Find the finger.
2. Make those pixels transparent.
3. Fill the holes, with my "fill holes by priority".
Step (1) is not easy, because there is printing on the pages the same colour as the glove. You could isolate all pixels of approximately that colour (or just that hue). Eliminate components not at the edge of the image. The largest remaining component is a finger.
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 fingers from scans
I have moved this topic to the Users form from Freds Scripts forum, since it does not seem to relate to my scripts. If the Users forum is not appropriate, then it could be moved to Image Processing forum.
Re: removing fingers from scans
Do you think it is a bad idea using a glove? I could use a glove of a rare colour, or I suppose if the book was just black and white any colour glove would work. Or would it be better idea just having normal skin colour without the glove? Or maybe it would be easier to go by the shape? In photosho the magic wand tool seems to detect the shape well.snibgo wrote:
Step (1) is not easy, because there is printing on the pages the same colour as the glove.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: removing fingers from scans
I don't use Photoshop. Does the magic wand require you to start with a pixel on the finger? If so, then, well, that's the part you want to automate.
The glove idea is good, because it gives a fairly saturated colour to search for. It's best if the finger is surrounded by white, or at least a solid colour. This simplifies searching, and also filling.
I think my approach would work fine, but it needs some work, and I don't currently have the time.
The glove idea is good, because it gives a fairly saturated colour to search for. It's best if the finger is surrounded by white, or at least a solid colour. This simplifies searching, and also filling.
I think my approach would work fine, but it needs some work, and I don't currently have the time.
snibgo's IM pages: im.snibgo.com
Re: removing fingers from scans
Yes you are correct it does require you to start with a pixel on the finger (and that is the part I want to automate) but once you click on the finger, Photoshop does a good job of selecting the shape of the finger.snibgo wrote:I don't use Photoshop. Does the magic wand require you to start with a pixel on the finger? If so, then, well, that's the part you want to automate.