http://stackoverflow.com/questions/1082 ... -of-pixels
Is there any method that would detect the clusters of pixels outlined in the question above?
Remove clusters of pixels
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Remove clusters of pixels
I don't see any pixel clusters indicated. The second image is totally black in Safari.
Last edited by fmw42 on 2012-05-30T20:12:51-07:00, edited 1 time in total.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Remove clusters of pixels
I see them fine in Firefox.
I would start by using morphology to generate a mask surrounding all the pixel groups. That is 'close' (open as your image is black on white) the gaps between 'near' pixels. That should simplify the image.
Once that is done you can find 'isolated' groups by eroding (dialate due to neagtivity) those cluster masks. What is left can be used as seed for a conditional dialation (conditional erosion) using the previous un-eroded image - without the 'isolated' clusters.
You now have a mask for the un-isolated clusters that can be used with the original image.
Basically -- simplify -- locate desired quality -- and restore (re-construct) those areas.
PS: it is probably easier to first negate the image, so you use the right morphology terminology for your processing.
See Morphology
http://www.imagemagick.org/Usage/morphology/#basics
I would start by using morphology to generate a mask surrounding all the pixel groups. That is 'close' (open as your image is black on white) the gaps between 'near' pixels. That should simplify the image.
Once that is done you can find 'isolated' groups by eroding (dialate due to neagtivity) those cluster masks. What is left can be used as seed for a conditional dialation (conditional erosion) using the previous un-eroded image - without the 'isolated' clusters.
You now have a mask for the un-isolated clusters that can be used with the original image.
Basically -- simplify -- locate desired quality -- and restore (re-construct) those areas.
PS: it is probably easier to first negate the image, so you use the right morphology terminology for your processing.
See Morphology
http://www.imagemagick.org/Usage/morphology/#basics
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Remove clusters of pixels
It would be good to have some function for this purpose.
It should be simple to select white areas, contract it a little bit to exclude the little white areas (we want to get only big white area). And then the new function needed to extend the "selection" (in terms of Photoshop; fill - in terms of IM) inside. So you would have mask with one big area white. The selection would be extended but not outwards, but inwards. This would remove the isolated areas.
It should be simple to select white areas, contract it a little bit to exclude the little white areas (we want to get only big white area). And then the new function needed to extend the "selection" (in terms of Photoshop; fill - in terms of IM) inside. So you would have mask with one big area white. The selection would be extended but not outwards, but inwards. This would remove the isolated areas.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Remove clusters of pixels
The problem is unless you are 'smoothing' which uses the same kernel set, it is very image dependant.VanGog wrote:It would be good to have some function for this purpose.
It should be simple to select white areas, contract it a little bit to exclude the little white areas (we want to get only big white area). And then the new function needed to extend the "selection" (in terms of Photoshop; fill - in terms of IM) inside. So you would have mask with one big area white. The selection would be extended but not outwards, but inwards. This would remove the isolated areas.
In your case you want a small one for generating a cluster mask. and a different one to remove isolated clusters.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/