Difficult Label_region question [message #59986] |
Wed, 23 April 2008 19:21  |
moxament
Messages: 26 Registered: April 2008
|
Junior Member |
|
|
Dear All,
I have a difficult label_region question (at least for me).
I have an image/array im[300, 300, 3] and I want to compare the the
value of of each element in each channel and write the bigger in a new
array imnew[300,300] keeping the information from which channel is the
element value in the new array.
for example if im[i, j, 0] qt im[i, j, 1] and im[i, j, 0] qt im[i, j,
2] then imnew[i, j] = im[i, j, 0]
and finally display the new array by giving red color for the elements
from the first channel, green color for elements from the second
channel, and blue color for elements from the third channel.
I have tried the label_region function, but I could not understand how
it work. It is so confusing function.
Thank you in advance,
MD
|
|
|
Re: Difficult Label_region question [message #60059 is a reply to message #59986] |
Thu, 24 April 2008 16:43  |
moxament
Messages: 26 Registered: April 2008
|
Junior Member |
|
|
On Apr 24, 11:55 am, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
> On Apr 24, 6:32 am, moxam...@gmail.com wrote:
>
>
>
>> On 24 Áðñ, 02:33, Gaurav <selfishgau...@gmail.com> wrote:
>
>>> But, of course, you will benefit greatly by reading about the WHERE
>>> function. It will cut a lot of your processing time if you are running
>>> loops (as it appears to be from the subscripts in your code).
>
>>> Cheers
>>> Gaurav
>
>> Thank you for the help. Your suggestions are good, but I think you did
>> not understand what I wanted exactly. I want to use the label_region
>> in order the imnew to contain three segments. The first segment
>> contains pixels from the first channel, the second segment contain
>> pixels from the second channel, and the third segment contains pixels
>> from the third channel. Having used the label_region I can tv the
>> imnew by giving one pseudo color to each segment (I do not know how to
>> do that as will).
>
> Not sure what you want, but is this close?
>
> m = max(im, ind, dimension=3)
> band = ind / (300 * 300)
>
> device, decomposed=0
>
> tvlct, 255, 0, 0, 0
> tvlct, 0, 255, 0, 1
> tvlct, 0, 0, 255, 2
>
> tv, band
>
> Mike
> --
> Tech-X Corporation
> Software Developer II
Not exactly but the tvlct helped me, I did not know it. Thank you very
much
MD
|
|
|