Re: Segmentation in ENVI [message #62422] |
Thu, 11 September 2008 00:30  |
Mort Canty
Messages: 134 Registered: March 2003
|
Senior Member |
|
|
guillermo.castilla.castellano@gmail.com schrieb:
>> Any idea why the ENVI built-in doesn't work?
>
> Well, I wouldn't say it doesn't work, it is simply intended to perform
> a different task, namely to partition into homogeneous regions a grey-
> level image. In your case (a classified image), you already have a
> partition where each region is a set of connected pixels sharing a
> common class. What you wanted to do is to single out the regions
> within your classified image, which is different from what is usually
> understood as 'segmentation'.
>
I wonder if we're talking about the same function. There are two
"Segmentation Image" commands in the ENVI main menu. The one I mean is
"Classification/Post Classification/Segmentation Image"
This command explicitly asks for an ENVI Classification Image and aborts
if you don't provide one. Then you can choose any combination (or all)
class labels and start segmenting. I think it should respect class
labels, otherwise it makes no sense (too me anyway). But it doesn't.
Cheers
Mort
|
|
|
Re: Segmentation in ENVI [message #62428 is a reply to message #62422] |
Wed, 10 September 2008 13:36   |
guillermo.castilla.ca
Messages: 27 Registered: September 2008
|
Junior Member |
|
|
> Any idea why the ENVI built-in doesn't work?
Well, I wouldn't say it doesn't work, it is simply intended to perform
a different task, namely to partition into homogeneous regions a grey-
level image. In your case (a classified image), you already have a
partition where each region is a set of connected pixels sharing a
common class. What you wanted to do is to single out the regions
within your classified image, which is different from what is usually
understood as 'segmentation'.
However, you are right in that the 'segmentation image' ENVI 'basic
tool' is too basic. First, it only handles one band at a time. And
second, it only produces a partial segmentation (only pixels that fall
within the entered DN range are considered). The good news is that new
ENVI Fx module tackles these deficiencies (and does way more than just
segmentation). The bad news is that you have to pay a separate fee for
it. However, there are other segmentation tools that you can get for
free in the ITTVIS codebank (e.g., my SCRM algorithm :).
Cheers
Guillermo
|
|
|
|
Re: Segmentation in ENVI [message #62430 is a reply to message #62429] |
Wed, 10 September 2008 09:46   |
guillermo.castilla.ca
Messages: 27 Registered: September 2008
|
Junior Member |
|
|
Mort,
This involves several calls to Label_Region, but perhaps is easier
than Pal's suggestion (and will work also for a 8-neighborhood, by
including the /all kw in the call):
lmig = LABEL_REGION(climg EQ cl[0],/ULONG)
FOR i = 1, n - 1 DO BEGIN
mxlb = MAX(limg)
climgi = climg EQ cl[i]
limg = TEMPORARY(limg) + (LABEL_REGION(climgi, /ULONG) +
climgi*maxlb)
ENDFOR
Where climg is your classified image and cl is an array of n elements
containing the (numeric) labels of your classes. You might need to
zero the frame of your image before doing this.
Cheers
Guillermo
>> Hi Mort,
>
>> Try LABEL_REGION in IDL.
>> basically does a similar thing, only asks for a n-dimensional image
>> array as input. so you can separate your classification map to a 3D
>> cube with as many classes you have (including 'Unclassified') and feed
>> that to label_region as the data argument.
>
>> Tal
>
> Sounds good. Many thanks, Tal.
>
> Mort
|
|
|
|
|
Re: Segmentation in ENVI [message #62507 is a reply to message #62422] |
Thu, 11 September 2008 08:26  |
guillermo.castilla.ca
Messages: 27 Registered: September 2008
|
Junior Member |
|
|
Hi Mort,
> I wonder if we're talking about the same function. There are two
> "Segmentation Image" commands in the ENVI main menu. The one I mean is
>
> "Classification/Post Classification/Segmentation Image"
Sorry, I wasn't aware that there was 'another' segmentation image tool
under 'post-classification'. You are right, if you select all classes
then a single segment is returned, not very useful indeed... My
suspicion is that the two 'segmentation image' tools are one and the
same. In the case of classified images, I think that the tool operates
in a binary image where pixels belonging to the selected classes are 1
and the rest are 0. This must be so, because in the ENVI help for this
item it says 'All the selected classes are combined before
segmenting'. To me this doesn't make sense either. Maybe you could
send ITTVIS an email reporting this, so that in future versions they
correct it.
Cheers
G
|
|
|