Re: Scale the psf on images. [message #89996 is a reply to message #89995] |
Wed, 14 January 2015 00:43   |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den onsdag 14 januari 2015 kl. 07:50:20 UTC+1 skrev anes.tz...@gmail.com:
> Hi Russel,
>
> Thanks a lot for your tip. I need to ask sometihng extra. I used the following:
> fits_read, 'im1.fits',image1,header1
> fits_read, 'im2.fits',image2,header2
> fits_read, 'im1.fits.psf.1.fits',image3,header3
> fits_read, 'im2.fits.psf.1.fits',image4,header4
>
> ;Compute the difference kernel
> psf1=fft(image3)
> psf2=fft(image4)
>
> kernel = REAL_PART(FFT(psf1/psf2, /INVERSE))
>
> image2_prime = convolve(image2, kernel)
> diff = image1 - image2_prime
>
> WRITEFITS,'im_conv.fits',diff,header1
>
>
> end
>
> No stars are seen in the resulting image, but the background has crazy values. The range is from -9e-8 to 9e8. What i have done wrong here?
Have a look at image2_prime, most likely it is dominated by amplified noise. If that is the case, you need to include a noise filter in your convolution operation.
You could inspect the Fourier transform of the kernel, psf1/psf2 in your notation (although I would have used otf1 and otf2 for the Fourier transforms of the psfs, otf = optical transfer function).
Look for spatial frequencies where the absolute values are > 1 (assuming both otfs are normalized to unity at the origin). Those are frequencies where you amplify image2. If image2 is dominated by noise at those frequencies (as is usually the case at high spatial frequencies), then the resulting image will be dominated by that. Zeroing the otf ratio in these frequencies in principle deals with this but may cause other problems, so you want a soft transition between zeroed frequencies and frequencies that are not zeroed.
How to deal with this is not an IDL question, it is more of a maths issue. Read up on low pass filters, in particular Wiener filters, in some image processing text book.
|
|
|