comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Difficult Label_region question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Difficult Label_region question [message #59984 is a reply to message #59983] Wed, 23 April 2008 21:33 Go to previous messageGo to previous message
Jonathan Dursi is currently offline  Jonathan Dursi
Messages: 9
Registered: November 2006
Junior Member
On Apr 23, 10:21 pm, moxam...@gmail.com wrote:

> 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.

It's not clear to me that label_region is really what you need
here.
The following seems more along those lines:

;; just get some random data

img = randomu(1,300,300,3)

;; find the maximum value along the colour axis,
;; along with where that maximum resides -- as a
;; 1d index into the entire img array

imgnew = max(img,ms,DIMENSION=3)

;; reform that 1d array of 1d indicies first into a 1d array
;; of 3d indicies into the array pointing where the maximum
;; is; put that back into the 300x300 shape of the initial
;; image, and take the only index we need, the color index

imgcolor = reform((reform(array_indices(img,ms),3,300,300))[2,*,*])

So now imgnew[xi,yi] has the maximum channel intensity
for pixel (xi,yi) and imgcolor[xi,yi] has the channel number
(0,1, or 2) of that maximum.

If you only want to do this for plotting purposes, there may
be some easier/faster way to go about it, but this seems like
the most direct way to get the asked-for info...


Jonathan
--
Jonathan Dursi
ljdursi@gmail.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Difficult Label_region question
Next Topic: dlm file not found automatically

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 10:14:51 PDT 2025

Total time taken to generate the page: 0.40418 seconds