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

Home » Public Forums » archive » Re: Extracting average pixel value
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: Extracting average pixel value [message #66304 is a reply to message #66171] Mon, 04 May 2009 00:46 Go to previous message
GP is currently offline  GP
Messages: 3
Registered: April 2009
Junior Member
On Apr 24, 2:53 am, James Kuyper <jameskuy...@verizon.net> wrote:
> Bennett wrote:
>> On Apr 23, 1:00 pm, Bennett <juggernau...@gmail.com> wrote:
> ...
>>> In IDL you can do a
>>> newArray = CONVOL(imageArray, [[1,1,1],[1,0,1],[1,1,1]], /CENTER)
>>> This will compute theaveragevalue in a 3x3 box around each pixel
>>> (except
>>> the edge pixels which you can set to zero or truncate or handle
>>> separately...
>>> whatever you please really.  Who needs edges anyway, right?)
>
>>> Bennett
>
>> I forgot to say also divide your resulting newArray by 8.
>
> Alternatively, you could divide the array of weighting factors by 8.

What do you think about this ENVI-approach to extract an average
window (profiled)
Once I open the stacked file (24 stacked layers) and get the id
lfile_id
...
arrayAvgYear = make_array(20,24, /float) ; ### ~ 24 periods per year
for 20 years.
noPixels = 9
countYear =0;
ENVI_FILE_QUERY, lfile_id, NS = ns, NL = nl, NB = nb, sname=sname,
interleave=interleave
pb= indgen(nb)
line1 = ENVI_GET_SLICE (fid = lfile_id, line=640,
pos=pb,xs=initSample, xe=lastSample )
line2 = ENVI_GET_SLICE (fid = lfile_id, line=641,
pos=pb,xs=initSample, xe=lastSample )
line3 = ENVI_GET_SLICE (fid = lfile_id, line=642,
pos=pb,xs=initSample, xe=lastSample )

For i=0, nb-1 Do Begin
arrayAvgYear[countYear,i] = (total(line1[*,i]) + total(line2[*,i])
+ total(line3[*,i])) / noPixels ;### Get the average for each image
of stacked layers
EndFor
countYear+=1 ;count for each year
fn+=1
IF (fn eq 2009) THEN BREAK
Endwhile

Then I just save the arrayAvgYear into a text file and I got a file
with one values for each year (every 14 days)

Date, Year1, Year2,... Year20
1, 0.3343, 0.233,
14, 0.3344, 0.334,
28, 0.3323, 0.344,
...
365

Any opinions...

Geo
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Spherical Surface Plot w/ fsc_surface from David Fanning (:
Next Topic: Re: An Callable IDL Question

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

Current Time: Tue Dec 02 22:05:49 PST 2025

Total time taken to generate the page: 0.72442 seconds