[magick-users] Magick++: Creating clipping mask
Anthony Thyssen
anthony at griffith.edu.au
Mon May 26 16:38:31 PDT 2008
Elie Zedeck RANDRIAMIANDRIRAY on wrote...
|
| > The fastest solution is Pixels::getConst(x,y,width,height) where typically you
| > would process a scanline of pixels at a time. If this is still not fast
| > enough you may want to use some other solution.
| Thanks for letting me know about that. But, you guessed it, it's still
| not fast enough for me.
|
| So, I went back to the creation of the clipping mask again. It's a lot
| faster still!
|
| There is something I don't understand in the creation process, which
| makes the final image containing noises.
|
| When I extract all the RGBA channels (Red, Green, Blue, Matte) from the
| Difference image (from DifferenceCompositeOp), and after doing
| threshold(0), the white parts of the mask is not fully white: it
| contains some black dots (usually 1 pixel only) spread around the white
| area.
|
| And when this clipping mask is used, the image has some dotted noises;
| not really noise, but transparencies, because they black noises.
|
| I have to run despeckle() to get rid of the noises, but despeckle()
| increases the surface of the white area of the clipping mask. So, I get
| a 1 to 2 pixels gap between the original (with transparency noises) and
| the de-noised mask.
|
| Is there something wrong that I did in the clipping mask creation
| process? What should I do to get rid of the noise?
|
You don't mention what type of images you are processing.
More than likely the dots are either dither noise, for images with
a fixed color limit like GIF; or CCD noise from digitial cameras,
especially cheap webcams which are low quality, and mass produced.
Basically your image inputs are probably noisy, so some filtering will
be required, which you now say you are doing.
You may like to look at some of the various mask filtering scripts that
Fred Weinhaus has created...
http://www.fmwconcepts.com/imagemagick/
The script "morphology' can decrease a mask area by one pixel.
It can also do a lot more than that too!
Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
-----------------------------------------------------------------------------
That's the thing about people who think they hate computers.
What they really hate is lousy programmers.
- Larry Niven and Jerry Pournelle, "Oath of Fealty"
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
More information about the Magick-users
mailing list