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

Home » Public Forums » archive » Re: filling multi spectral 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: filling multi spectral image [message #65827] Thu, 26 March 2009 06:15 Go to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Mar 25, 8:22 am, a.mozafari1...@googlemail.com wrote:
> Hi
> Folks I have one Hyperion scene (multi spectral image) with 250 bands
> and each band has some no datas number. I want to fill this no data
> for all 250 bands with the average of neighbour data. Is there any
> easy way to do this?
> Any help highly will be appreciated.
> Cheers

This question keeps coming up lately, doesn't it? Might be worth
searching the newsgroup...

Anyway, this would be my quick-and-dirty solution if you can safely
assume that no "bad" pixels are either at the edge of the image or
adjacent to another bad pixel. Assume that scene is a [nx,ny,nband]
floating point array, and bad pixels are marked by "badpixelvalue".

badpix = where(scene eq badpixelvalue, nbadpix)
if nbadpix gt 0 then begin
badpix_xyb = array_indices(scene, badpix)
xneighbours = rebin(badpix_xyb[0,*],4,nbadpix)+rebin([-1,1,-1,1],
4,nbadpix)
yneighbours = rebin(badpix_xyb[1,*],4,nbadpix)+rebin([-1,-1,1,1],
4,nbadpix)
scene[badpix] = total(scene[xneighbours,yneighbours,rebin(badpix_xyb
[2,*],4,nbadpix)])/4.
endif

-Jeremy.
Re: filling multi spectral image [message #65902 is a reply to message #65827] Fri, 27 March 2009 03:03 Go to previous message
a.mozafari1211 is currently offline  a.mozafari1211
Messages: 16
Registered: February 2009
Junior Member
On Mar 26, 2:15 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Mar 25, 8:22 am, a.mozafari1...@googlemail.com wrote:
>
>> Hi
>> Folks I have one Hyperion scene (multi spectral image) with 250 bands
>> and each band has some no datas number. I want to fill this no data
>> for all 250 bands with the average of neighbour data. Is there any
>> easy way to do this?
>> Any help highly will be appreciated.
>> Cheers
>
> This question keeps coming up lately, doesn't it? Might be worth
> searching the newsgroup...
>
> Anyway, this would be my quick-and-dirty solution if you can safely
> assume that no "bad" pixels are either at the edge of the image or
> adjacent to another bad pixel. Assume that scene is a [nx,ny,nband]
> floating point array, and bad pixels are marked by "badpixelvalue".
>
> badpix = where(scene eq badpixelvalue, nbadpix)
> if nbadpix gt 0 then begin
>   badpix_xyb = array_indices(scene, badpix)
>   xneighbours = rebin(badpix_xyb[0,*],4,nbadpix)+rebin([-1,1,-1,1],
> 4,nbadpix)
>   yneighbours = rebin(badpix_xyb[1,*],4,nbadpix)+rebin([-1,-1,1,1],
> 4,nbadpix)
>   scene[badpix] = total(scene[xneighbours,yneighbours,rebin(badpix_xyb
> [2,*],4,nbadpix)])/4.
> endif
>
> -Jeremy.

thank you Jeremy. seems work perfect.
Cheers
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: reading or converting avi files
Next Topic: ATI graphics cards and IDL object graphics

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

Current Time: Wed Oct 08 19:20:14 PDT 2025

Total time taken to generate the page: 0.00628 seconds