Hi I have a fits image that I read in with pyfits.getdata which has heavy vignetting along in the corners of the image. I create a second numpy array with the same dimensions as the original image, having a value for a bad pixel as 1 and a usable one as 0. To detect point sources I use pysex on the original image. The pysex routine detects fluctuation in the vignetted area as point sources. How can I interpolate over the array marking the bad pixels. I have tried scipy.interpolate.griddataand scipy.interpolate.interp2d and the required arguments are not clear, what is the simplest solution?
Interpolation over an image for marking of bad pixels in python
2k Views Asked by user2739303 At
2
You have bad pixel at (x0,y0) = 5,10 and an other one at (x1,y1) = 50,100
it's like [x0,x1,x2,x3],[y0,y1,y2,y3] , not very intuitive I admit
You want more, This is a really good post : Fast interpolation of grid data
But actuallly I would use scipy.filter.uniform_filter for bad pixels. It gives you the value of the average of the neigbourgs. It is not as precise a a cubic interpolation but it is more robust. Even better scipy.filter.median_filter in case you have 2 bad pixels near each other.