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

Home » Public Forums » archive » Adding/Subtracting/Multiplying images together
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
Adding/Subtracting/Multiplying images together [message #67468] Tue, 21 July 2009 13:37 Go to next message
Barbara is currently offline  Barbara
Messages: 17
Registered: July 2009
Junior Member
I am extremely new to IDL, and am working with an astronomy professor
looks at fits files. I have been able to split the header and image
apart, however now I must be able to add images, then multiply them,
and find the average image. Does anyone know how to do this?
Re: Adding/Subtracting/Multiplying images together [message #92829 is a reply to message #67468] Tue, 08 March 2016 18:27 Go to previous messageGo to next message
soniya.iiser is currently offline  soniya.iiser
Messages: 1
Registered: March 2016
Junior Member
On Wednesday, 22 July 2009 06:37:21 UTC+10, Barbara wrote:
> I am extremely new to IDL, and am working with an astronomy professor
> looks at fits files. I have been able to split the header and image
> apart, however now I must be able to add images, then multiply them,
> and find the average image. Does anyone know how to do this?

As a follow up to this question how to add if the wcs of the images dont match ? Then I guess
image_added = image_1 + image_2 this wouldn't work.. Is that right?
Re: Adding/Subtracting/Multiplying images together [message #92834 is a reply to message #92829] Wed, 09 March 2016 06:03 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Tuesday, March 8, 2016 at 9:27:33 PM UTC-5, soniya...@gmail.com wrote:

> As a follow up to this question how to add if the wcs of the images dont match ? Then I guess
> image_added = image_1 + image_2 this wouldn't work.. Is that right?

One thing to try is the procedure hastrom.pro
http://idlastro.gsfc.nasa.gov/ftp/pro/astrom/hastrom.pro

Given the image array and FITS header of the first image, and the FITS header of the second image, this procedure will warp the first image until its astrometry matches that of the second image. You can then directly add the images together.

--Wayne
Re: Adding/Subtracting/Multiplying images together [message #92835 is a reply to message #92829] Wed, 09 March 2016 06:04 Go to previous messageGo to next message
Russell[1] is currently offline  Russell[1]
Messages: 101
Registered: August 2011
Senior Member
Soniya...

This is a very tough question to answer, because it depends critically on the properties of the images to add and the (desired) property of the result. In broad-brush terms, you will need to interpolate one image to the WCS of the other, before proceeding. If you are familiar with the IDL astrolib, then you can use hastrom, but that will only bi-linear interpolate --- and you might actually want/need something fancier (such as sinc-interpolation). That issue withstanding, the notion of "adding" is not actually that clear when you have a pixelated image, look up the process of drizzling:

http://drizzlepac.stsci.edu

of course that is relevant to HST only, but the mathematical underpinning is generic to any telescope/camera. You might also look at SWarp:

http://www.astromatic.net/software/swarp

which does very similar things.

However, be very (no VERRRRRYYYY) cautious with this. Any interpolation you do (bilinear, sinc, drizzle, etc.) will by it's VERY nature, introduce pixel correlation to your image. If you're a grad student, you've probably heard senior faculty or postdocs complain about "correlated errors"? Well, this is the worst manifestation of that problem. So, you need to be very careful in interpreting the results and understanding properties of your resultant image.

Good luck,
Russell

PS. I tried to make this sound very grave, because it is actually a tough problem. However it's so bad, many people have developed many ways of cracking this nut. I've just pointed you to the two most common approaches.


On Wednesday, March 9, 2016 at 3:27:33 AM UTC+1, soniya...@gmail.com wrote:
> On Wednesday, 22 July 2009 06:37:21 UTC+10, Barbara wrote:
>> I am extremely new to IDL, and am working with an astronomy professor
>> looks at fits files. I have been able to split the header and image
>> apart, however now I must be able to add images, then multiply them,
>> and find the average image. Does anyone know how to do this?
>
> As a follow up to this question how to add if the wcs of the images dont match ? Then I guess
> image_added = image_1 + image_2 this wouldn't work.. Is that right?
Re: Adding/Subtracting/Multiplying images together [message #92836 is a reply to message #92835] Wed, 09 March 2016 07:04 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Wednesday, March 9, 2016 at 9:04:54 AM UTC-5, rrya...@gmail.com wrote:
> Soniya...
>
> This is a very tough question to answer, because it depends critically on the properties of the images to add and the (desired) property of the result.

I agree with this and only add a couple of comments. First, hastrom.pro uses the IDL internal function POLY_2D(), and so allows both bilinear and cubic interpolation. I find that setting CUBIC=-0.5 works well for high signal to noise data.

Among the reasons for co-adding images are to create a prettier picture, to improve photometry, and to identify weak features not visible on a single image. For a prettier (higher S/N) picture, the particular interpolation method is not very important. For precision photometry of a bright source, it is often better to perform the photometry on individual images and then statistically coadd the photometry results. (I was involved recently in a project like this where drizzle interpolation gave surprisingly poor results.) In other cases, yes it is something of an art to determine the best interpolation method (and not all methods are easily available in IDL).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: triangulate error
Next Topic: Period of RANDOMU generated random numbers??

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

Current Time: Wed Oct 08 09:22:27 PDT 2025

Total time taken to generate the page: 0.00636 seconds