Page 2 of 2

Re: Cleaning up noise around text

Posted: 2011-05-16T09:15:05-07:00
by mark0978
I was kind of stunned at how well some of the cleanups worked. Thanks very much.

Re: Cleaning up noise around text

Posted: 2011-05-16T16:37:29-07:00
by anthony
Some of the clean up methods can be great, but the real problem is matching the right clean-up to the specific problem. It is not something that can be automated in a general case, only for a specific situation or sequence of image processing.

I was suprised I did not get any comment on the first use of a write-mask' to create a conditional-dilate (erode).

In any case I am glad we were able to help.

Re: Cleaning up noise around text

Posted: 2011-05-18T14:02:54-07:00
by HugoRune
It is a pretty nifty application for write masks. I had not known there were clip-masks in imagemagick before, they look like they could be useful for all sorts of things.

one application would be a canny-style edge detector

something like
convert lenna.png -edge 1 -threshold 70% edges_strong.png
convert lenna.png -edge 1 -threshold 10% -negate edges_weak.png
convert edges_strong.png -clip-mask edges_weak.png -morphology dilate:500 square +clip-mask edges.png


That should be equivalent to the hysteresis thresholding part of the canny edge detector. A little slow due to the neccessity of a fixed iteration count, would probably be faster in im7

the non-maximum suppression part should be possible with a looong -fx expression, though it might need some nested IFs and would be very slow. Have to think about that a bit more

Re: Cleaning up noise around text

Posted: 2011-05-18T20:14:39-07:00
by anthony
Nice example of using a pixel write mask.

the 500 is a little overboard for edge detection. 5 should be enough.

The alternative to that is some sort of external loop with 'change' detection to figure out when to terminate.
probably best done in a actual API so you don't need to re-initialise every time after checking for more changes.

Re: Cleaning up noise around text

Posted: 2012-02-01T05:22:27-07:00
by anthony

IMv7 an images write mask will definitely be visible to operational pixel processing loops. As such things that do major calculations such as morphology and convolutions can see the write mask of an image, and as such 'skip' the calculations for pixels that are not actually writeable!

That should make write masks MUCH faster, and even allow morphology with infinite iterations to abort when no more 'writable' pixels change.

NOTE even in IMv6 write masks are used internally to implement 'masked compostions'.