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

Home » Public Forums » archive » Re: Simple question,
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: Simple question, [message #28853] Mon, 14 January 2002 05:06
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
>
> I have an array (251,251,16). I would like to average value of pixel
> where there is mask value of 255 by befor anf after values.
>
> ====This code works===
>
> for k=1, 10 do begin
> temp1(*,*,k)=((temp(*,*,k-1)+temp(*,*,k+1))/2) * (temp(*,*,k) eq
> 255) + (temp(*,*,k) * (temp(*,*,k) ne 255))
>
> end
>
> ====
>
> ====But this code doesn�t work====
..........
"Then don't do it!" Tommy Cooper


Sorry but I couldn't resist

Martin
Re: Simple question, [message #28863 is a reply to message #28853] Sat, 12 January 2002 15:32 Go to previous message
gogosgogos is currently offline  gogosgogos
Messages: 15
Registered: July 2001
Junior Member
use the > and < operators
they will truncate the other values to 255

result = array > 255
result = array < 255

if you mean averaging a subarray, try something like:

masked = array * (array GE 255)
array_mean = mean(masked)

hope this helps, not sure what you are up to

cheers!

dinhnq@yahoo.com (Dinh Huong) wrote in message news:<b5f3d715.0201120753.d515dc8@posting.google.com>...
> Dear lists,
>
> I have an array (251,251,16). I would like to average value of pixel
> where there is mask value of 255 by befor anf after values.
>
> ====This code works===
>
> for k=1, 10 do begin
> temp1(*,*,k)=((temp(*,*,k-1)+temp(*,*,k+1))/2) * (temp(*,*,k) eq
> 255) + (temp(*,*,k) * (temp(*,*,k) ne 255))
>
> end
>
> ====
>
> ====But this code doesn�t work====
>
> i=indgen(251)
> j=indgen(251)
> k=indgen(16)
>
> for k = 2,13 do begin
>
> temp1(*,*,k)=(temp(*,*,k) * (temp(*,*,k) ne 255) + $
> ((temp(*,*,k-2)*(temp(*,*,k-1) eq 255) + (temp(*,*,k-1)*(temp(*,*,k-1)
> ne 255) + $
> temp(*,*,k+1)*(temp(*,*,k+1) ne 255) + temp(*,*,k+2)*(temp(*,*,k+1) eq
> 255))/2 * (temp(*,*,k) eq 255)
>
> endfor
>
> Thank you for your helps,
>
> Huong Dinh
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Changing the order of true color images
Next Topic: Using Perl w/idl

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

Current Time: Wed Oct 08 13:33:12 PDT 2025

Total time taken to generate the page: 0.00502 seconds