Noise removal from scanned document for auto crop

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Posts: 3
Joined: 2018-06-03T22:53:05-07:00
Authentication code: 1152

Noise removal from scanned document for auto crop

Post by Jivec » 2018-06-03T23:05:35-07:00

Thank you in advance for your time


The images are Scanned documents with 300 DPI
The original problem is that i have an image

and as you can see i have a bit of noise at random spots outside of the area of interest. I tried many ways to clean the noise and after some searching i found out about the `connectedComponents ` method.

I'm trying to follow this well documented topic but i don't know how i can implement it since connectedComponents seems to not working like i thought.


I also tried to create a mask of the image above but i'm not so sure if i'm applying it the correct way, because it doesn't seem to work.

Code: Select all

mgImgModified.Composite(origImg, CompositeOperator.CopyAlpha);
and i also tried this.

Code: Select all

origImg.ReadMask = mgImgModified;
The last one seems to have an effect on the image but not the desired one.


My end goal is to dynamically clean the noise around the area of interest in order to be able to auto crop the image, to only the part i want in every instance.

Thank you:)

Post Reply