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

Home » Public Forums » archive » Re: flux-conserving image resampling?
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: flux-conserving image resampling? [message #47689] Fri, 24 February 2006 08:04
edward.s.meinel@aero. is currently offline  edward.s.meinel@aero.
Messages: 52
Registered: February 2005
Member
If you are interested in the flux difference of two images of the same
star, can't you just calculate the total flux of each star and then
subtract the results? I assume you aren't looking at the sun, so the
star would be unresolved...

Ed

Marshall Perrin wrote:
> Bringfried Stecklum <stecklum@tls-tautenburg.de> wrote:
>> I did not check how well it preserves the flux. In any case, you can
>> force the total flux of the output image to be the same as that of the
>> input image.
>
> As Henry points out, this isn't really sufficient to ensure that the
> original flux stays in the right parts of the final image. That's important
> for my particular application, which is a dual-beam differential polarimeter.
> I'm trying to take a very precise difference between two images of
> the same star taken simultaneously on different parts of the detector,
> and thus merely enforcing total flux conservation lets light slop between
> the two stellar images (and the background too). Yes, it's a small effect,
> but I'm trying to -measure- a fairly small difference in the first place and
> thus care about this.
>
> - Marshall
Re: flux-conserving image resampling? [message #47696 is a reply to message #47689] Fri, 24 February 2006 01:03 Go to previous message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
Marshall Perrin wrote:
> Bringfried Stecklum <stecklum@tls-tautenburg.de> wrote:
>
>> I did not check how well it preserves the flux. In any case, you can
>> force the total flux of the output image to be the same as that of the
>> input image.
>
>
> As Henry points out, this isn't really sufficient to ensure that the
> original flux stays in the right parts of the final image. That's important
> for my particular application, which is a dual-beam differential polarimeter.
> I'm trying to take a very precise difference between two images of
> the same star taken simultaneously on different parts of the detector,
> and thus merely enforcing total flux conservation lets light slop between
> the two stellar images (and the background too). Yes, it's a small effect,
> but I'm trying to -measure- a fairly small difference in the first place and
> thus care about this.
>
> - Marshall

Ah, I see your point. I guess what has to be done is to account for the
difference in pixel size between the original and the corrected image.
The code I've written only does resampling on a grid which represents
the pixel location of the undistorted image. In order to preserve the
flux locally, one has to keep in mind that depending on the distortion
one pixel of the corrected image will subtend an area of less or more than
one pixel in the original image. Well, I'm not talking about sub-pixels here
(we had this earlier in the group...). For instance in the simple case of a
Wollaston which has slightly different image scales for the O and E beams,
the ratio of those scales should be applied after one image has been
registered to the other. In some sense this photometric correction can
be considered as distortion flatfield.

- Bringfried
Re: flux-conserving image resampling? [message #47704 is a reply to message #47696] Thu, 23 February 2006 09:39 Go to previous message
Marshall Perrin is currently offline  Marshall Perrin
Messages: 44
Registered: December 2005
Member
Bringfried Stecklum <stecklum@tls-tautenburg.de> wrote:
> I did not check how well it preserves the flux. In any case, you can
> force the total flux of the output image to be the same as that of the
> input image.

As Henry points out, this isn't really sufficient to ensure that the
original flux stays in the right parts of the final image. That's important
for my particular application, which is a dual-beam differential polarimeter.
I'm trying to take a very precise difference between two images of
the same star taken simultaneously on different parts of the detector,
and thus merely enforcing total flux conservation lets light slop between
the two stellar images (and the background too). Yes, it's a small effect,
but I'm trying to -measure- a fairly small difference in the first place and
thus care about this.

- Marshall
Re: flux-conserving image resampling? [message #47711 is a reply to message #47704] Thu, 23 February 2006 08:00 Go to previous message
henrygroe is currently offline  henrygroe
Messages: 30
Registered: August 2003
Member
I've faced similar problems; The thing I would worry about with some
of the 'flux conserving' algorithms out there is that while the total
flux in the image is conserved, that does not mean the total flux in
each object is conserved.

-Henry
Re: flux-conserving image resampling? [message #47722 is a reply to message #47711] Thu, 23 February 2006 00:32 Go to previous message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
Marshall Perrin wrote:
> Some time ago, there was a thread in this newsgroup on 'drizzle'-like
> image resampling methods, much of which is preserved on David's web
> page. Well, actually it was mostly a thread on clever and
> convoluted histogram tricks, and resulted in some speedy solutions to
> array decimation. But the ultimate consensus then was that there is
> no good drizzle-like flux conserving image resampler in IDL, and maybe
> C is a better way to go.
>
> Before I sit down and reinvent the wheel on this one, I thought I'd
> ask around and see what, if any, code for this might exist now a few
> years later. I'm looking for a good way to take pixellated data
> measured in a camera with known field distortion and resample them
> onto a regular grid. Drizzle or PyDrizzle would do what I want,
> except it seems fairly nontrivial to get them to accept non-HST data.
> (Am I wrong? If anyone has tips on how to do this, I'm all ears.)
> If anyone knows of an IDL solution for this, or a C DLM, I'd be most
> appreciative... And failing that, at least knowing definitively that
> no such thing exists now would probably help fortify my spirits for
> writing my own!
>
> Thanks,
>
> - Marshall
>
>

Dear Marshall,

I am not quite sure whether you really need a drizzle algorithm for correcting
the image distortion. In IRAF, the geotran task does geometrical image
transformation. The necessary distortion coefficients can be derived with
geomap. Here are a few lines of IDL code I've written to correct the image
distortion of ESO's ISAAC NIR instrument using 2nd order polynomials.
I did not check how well it preserves the flux. In any case, you can
force the total flux of the output image to be the same as that of the
input image.

Regards,

Bringfried

;----------------------------------------------------------- --------------

function cdistort,image,px=px,py=py,resample=resample

; distortion coefficients, assume ISAAC as default
if not keyword_set(px) then px=[0.7246,-0.3609,-0.04242,-0.05569,1.905,1.887,-0.0564]
if not keyword_set(py) then py=[-0.3529,0.1274,0.8327,2.411,0.004007,0.1202,2.386]

if not keyword_set(resample) then resample=1

npix=resample*1024

x=findgen(npix)
xni=(2*(x-npix/2.)/npix)#replicate(1.,npix)
yni=transpose(xni)
xni2=xni^2
yni2=yni^2

dx=resample*(px[0]*xni*yni+px[1]*xni2+px[2]*yni2+px[3]*xni2* yni+px[4]*xni*yni2+px[5]*xni2*xni+px[6]*yni2*yni)
dy=resample*(py[0]*xni*yni+py[1]*xni2+py[2]*yni2+py[3]*xni2* yni+py[4]*xni*yni2+py[5]*xni2*xni+py[6]*yni2*yni)

if not keyword_set(resample) then cimage=image else cimage=CONGRID(image,npix,npix,cubic=-0.5)

xni=(xni+1)*npix/2.
yni=(yni+1)*npix/2.
xci=xni+dx
yci=yni+dy

if not keyword_set(resample) then return,cimage[xci,yci] else return,rebin(cimage[xci,yci],1024,1024)

end
  • Attachment: stecklum.vcf
    (Size: 0.20KB, Downloaded 77 times)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ARRAY OF ARRAYS
Next Topic: Re: How to call an IDL procedure from a DLM

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

Current Time: Wed Oct 08 19:16:41 PDT 2025

Total time taken to generate the page: 0.00736 seconds