Remove difficult noise from scan

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
brighthero
Posts: 8
Joined: 2017-09-12T07:00:23-07:00
Authentication code: 1151

Remove difficult noise from scan

Post by brighthero » 2017-09-12T07:05:01-07:00

I've scanned a page of notebook paper and my scanner always introduces this weird noise.
I want to keep the lines and also the notes themselves.
Any ideas?

Example: https://i.imgur.com/4dl23SS.jpg

User avatar
fmw42
Posts: 22091
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Remove difficult noise from scan

Post by fmw42 » 2017-09-12T09:06:38-07:00

brighthero wrote:
2017-09-12T07:05:01-07:00
I've scanned a page of notebook paper and my scanner always introduces this weird noise.
I want to keep the lines and also the notes themselves.
Any ideas?

Example: https://i.imgur.com/4dl23SS.jpg

Please always provide your IM version and platform/OS, since syntax and scripting differs.

If on Unix-like system, you can use my script text cleaner to improve your document.

Code: Select all

textcleaner -f 25 -o 10 4dl23SS.jpg 4dl23SS_clean25x10.jpg
Image

Otherwise, try

Code: Select all

convert 4dl23SS.jpg -negate -lat 25x25+10% -negate 4dl23SS_lat25x10.jpg
That will lose color, but you can use it as a mask to clean up your image.

brighthero
Posts: 8
Joined: 2017-09-12T07:00:23-07:00
Authentication code: 1151

Re: Remove difficult noise from scan

Post by brighthero » 2017-09-12T09:35:01-07:00

Thanks man, I really like your website and have used your scripts before.
The only problem I have with your script is that the filter removes big dark shapes, like logos and so on (see the punch holes in the page). Is there any way to prevent this?

User avatar
fmw42
Posts: 22091
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Remove difficult noise from scan

Post by fmw42 » 2017-09-12T10:28:01-07:00

Increase the -f argument until it does not remove the holes. The argument will depend upon how large a region you want to preserve. But it will take longer. At -f 75 it leaves the holes. But at -f 50 they are only about half filled. So somewhere in between they get filled.

Tillomar
Posts: 3
Joined: 2017-09-12T09:25:37-07:00
Authentication code: 1151

Re: Remove difficult noise from scan

Post by Tillomar » 2017-09-12T10:56:29-07:00

Did you try to put a black background behind your notepad page (during scanning)? Depending on the paper, that might help a lot.

ozbigben
Posts: 24
Joined: 2012-03-25T02:15:27-07:00
Authentication code: 8675308

Re: Remove difficult noise from scan

Post by ozbigben » 2017-09-14T01:18:31-07:00

fmw42 wrote:
2017-09-12T09:06:38-07:00

Code: Select all

convert 4dl23SS.jpg -negate -lat 25x25+10% -negate 4dl23SS_lat25x10.jpg
you can shorten this to

Code: Select all

convert 4dl23SS.jpg -lat 25x25-10% 4dl23SS_lat25x10.jpg
Tillomar wrote:
2017-09-12T10:56:29-07:00
Did you try to put a black background behind your notepad page (during scanning)? Depending on the paper, that might help a lot.
Black paper reduces bleed through of writing on the back but darkens the image with thin paper which is the problem here. If there is no writing then white paper produces a cleaner scan of thin paper.

As a quick clean up (for those on Win) you can then use composite to add the cleaned image to the original, using the cleaned image as a mask.

Post Reply