Aggregation of neighbour pixels with the same value

732
1
01-11-2011 07:31 AM
GuillemDomènech_i_Surinyach
New Contributor
Dear colleagues,

I need to identify clusters of pixels with the same value and an area lower than a specific value. If some of these clusters are surrounded by a group of pixels that have the same value each other, I need to give to this clusters the same value than the pixels around them. The main problem is that I have a lot of clusters and I need to do it automatically.
I attached an example (fig1). In this case, there are four clusters: Two of orange pixels and two of green pixels. In both cases they are surrounded by yellow pixels, hence, pixels of this four clusters should be convert into yellow color.
If someone knew a methodology to do it I would be really grateful.

Best wishes,

Guillem
0 Kudos
1 Reply
GuillemDomènech_i_Surinyach
New Contributor
Dear William huber,

Many thanks for your help. I have tried it and it works perfectly. It has solved perfectly my question. It is also very fast and you don't have to transform from raster to polygon, which sometimes is a bit problematic.

Cheers,

Guillem
0 Kudos