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

Home » Public Forums » archive » Re: Get min and max values from a multiband image according to pixel locations of classification image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Get min and max values from a multiband image according to pixel locations of classification image [message #82055] Sat, 17 November 2012 07:53
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> class1Pixels = Where(classifiedImage EQ class1, count)
> IF count GT 0 THEN BEGIN
> class1Min = minImage[class1Pixels]
> class1Max = maxImage[class1Pixels]
> ENDIF

If your images are large, it is often MUCH faster
to use the Histogram command to locate classified
pixels. Assume, for example, that in your classified
image, the three classes are labeled with 1, 2, and 3.
Then:

h = Histogram(classifiedImage, BinSize=1B, Reverse_Indices=ri)
class1Pixels = Reverse_Indices(ri, 1, COUNT=cnt1)
class2Pixels = Reverse_Indices(ri, 2, COUNT=cnt2)

Etc.

You can find Reverse_Indices here:

http://www.idlcoyote.com/programs/reverse_indices.pro

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Get min and max values from a multiband image according to pixel locations of classification image [message #82056 is a reply to message #82055] Sat, 17 November 2012 07:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dry in water writes:

>
> Hello all,
>
> I have a question to solve following issue.
> I have two images. One is a multiband image with 7bands. Another is an classifiction image with 3 classes. The classes named by class1 to class3. I'd like to obtain a single max/min values from a multiband image according to pixel locations of each classes (class1, class2, class3) of classification image. Could you help me for this?
>
> Thank you very much

Get the MIN and MAX values of the band interleaved image:

minImage = Min(image, DIMENSION=3, Max=MaxImage)

Locate class pixels:

class1Pixels = Where(classifiedImage EQ class1, count)
IF count GT 0 THEN BEGIN
class1Min = minImage[class1Pixels]
class1Max = maxImage[class1Pixels]
ENDIF

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Get min and max values from a multiband image according to pixel locations of classification image
Next Topic: Rare View of Aurora Australis

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

Current Time: Wed Oct 08 19:18:49 PDT 2025

Total time taken to generate the page: 0.00603 seconds