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

Home » Public Forums » archive » Image subtraction
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: image subtraction [message #29782 is a reply to message #11675] Wed, 13 March 2002 16:21 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
aburden@mpl.ucsd.edu (Art) writes:
> Hi,
>
> Can anyone come up with an efficient way to subtract a single image
> from an array of images without using a loop, as in
>
> imgArr = imgArr - img1
>
> where,
>
> imgArr = lonarr(12,512,512)
>
> and,
>
> img1 = lonarr(512,512)
>
> as opposed to
>
> For ii=0,11 do imgArr[ii,*,*] = imgArr[ii,*,*] - img1

(a) You can do this:
imgarr = imgarr - rebin(reform(img1,1,512,512),12,512,512)

This makes IMG1 into a 1x512x512 array, and then uses REBIN to
expand it to the desired size.

(b) I don't think a FOR loop will be that much slower than the REBIN
approach, at least for 512x512 arrays.

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
Read Message
Read Message
Previous Topic: Re: How to retrieve the event structure returned to event function of widget ?
Next Topic: IDL 4.0.1: How to "fill" volume inside isosurface?

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

Current Time: Sat Oct 11 15:43:47 PDT 2025

Total time taken to generate the page: 0.08342 seconds