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

Home » Public Forums » archive » Re: Working with 2 partially overlapping images of different array sizes
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: Working with 2 partially overlapping images of different array sizes [message #28865 is a reply to message #28836] Fri, 11 January 2002 19:08 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
aqueous0123@yahoo.com (aqueous) writes:
> Sorry, I'm new to this image processing stuff.
>
> I have 2 images of different sizes and different, but overlapping,
> locations on the globe. E.g., 2 satellite images from different
> sensors.
>
>
> |||||||||||||||| <- IMAGE_1 = bytarr(532,532)
> | |
> | ''''''''''''''''''
> | ' | '
> | ' | '
> | ' | '
> | ' | '
> | ' | '
> ||'||||||||||||| ' <- IMAGE_2 = bytarr(250,200)
> ''''''''''''''''''
>
... [ deletions ] ...
> What I wish to do is create a new array IMAGE_3 that is the same array
> size (532,532) as IMAGE_1 AND also has the same physical location as
> IMAGE_1, but with IMAGE_2's data where IMAGE_1 and IMAGE_2 overlap
> (the 2's in the graphic below). Where they do not overlap, I'll just
> fill IMAGE_3 with nearest neighbor of IMAGE_2 (the 0's in the grahic
> below).
>
... [ deletions ] ...

What you are asking for is 100% what the function INTERPOLATE() will
do for you. The only trick is to make the X and Y arrays for the
interpolation. You are trying to interpolate IMAGE2 onto the grid for
IMAGE1, so what you want is an array of X values and Y values that
express the IMAGE1 grid in the coordinate system of IMAGE2.

;; Length of image 2 in the X and Y directions
lenx2 = max(lons2)-min(lons2) & leny2 = max(lats2)-min(lats2)
;; Pixel sizes of each image
dx2 = lenx2/n_elements(lons2) & dy2 = leny2/n_elements(lats2)

x1 = (lons1-lons2(0))/dx2
y1 = (lats1-lats2(0))/dy2

image3 = interpolate(image2, x1, y1, /grid)

Based on what you said, you definitely don't want to use MISSING,
because you want nearest neighbor on the outskirts where IMAGE2 is not
defined. [ If you really wanted to set to zero then you would say,
MISSING=0. ]

Good luck,
Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Large TIFF file question
Next Topic: Re: load sharing on multiple machines?

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

Current Time: Thu Oct 09 23:33:42 PDT 2025

Total time taken to generate the page: 1.27965 seconds