Re: Label Region trouble [message #37994] |
Wed, 11 February 2004 07:26  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Nuno Oliveira wrote:
> Thanks for the solution, Ben. Well, it's little bit embarrassing to me. I've
> read the description of the Label_Region function, but obviously not that
> careful.
>
>
Hi,
You shouldn't be embarassed. I have been there, too! I think if you
searched the Google database for this ("label_Region" and "Edge") you
find that I *really* have been there. There maybe other, faster, ways
of doing this.
The only thing you should be embarassed about is using CW_DEFROI (just
kidding!)
>
> I'm not sure if I understood your suggestion of using histogram function. I
> read the description of the function and perhaps I still don't get it.
>
Yeah, well, only JD really knows how histogram works - I just ape the
same steps over and over. You should look at JD's tutorial on
HISTOGRAM. David F hosts this for the benefit of all at
http://www.dfanning.com/documents/tips.html#Tutorials
> hist = HISTOGRAM(data, REVERSE_INDICES=R)
>
>
>
> To get de indices for first region defined by label region (the indices that
> are equal to 1) I should do... (according to the reference guide.)
>
>
>
> i = 1
>
> blob = data( R[ R(i):R(i+1)-1 ] )
>
> Is that it? If I haven't made any mistake I'm trying this and I get nothing
> back (or I get strange array with two indices when should have much more)
Well, I'm not sure what is happening. I suggest that you make sure that
data is the labeled image (not the original). Also, note the following...
i = 1
hist[i] = number of pixels in bin number i
(in this case i is also the pixel values)
indices = R[ R[i]:R[i+1]-1 ] = data indices for all of the pixels in bin i
blob = data[indices] = all of the pixels in bin i
(in this case they should all have a value of i)
Ben
|
|
|