Re: CCD saturation [message #63117 is a reply to message #63031] |
Mon, 27 October 2008 06:43  |
MichaelT
Messages: 52 Registered: May 2006
|
Member |
|
|
A couple of years ago I did something like this to remove the streaks
(can't find the program any more, though...):
First label all stars in your image (img) which have pixel values
above a threshold value
lab = Label_Region(img gt threshold)
h = (histogram(lab))[1: *] ;[1: *] removes background pixel count
dims = Size(img, /Dimensions) ;image dimensions
So h now contains the pixel count for each identified area. Saturated
stars with streaks usually have a pixel count above a certain value
(their area is larger). In a loop I then checked which area is larger
than other_threshold and then determined the aspect ratio of each of
these areas:
;Areas larger than 100 pixels probably have streaks (or whatever
threshold is best in your case)
other_threshold = 100
w = Where(h gt other_threshold, n_areas)
;limiting aspect ratio, example: 1.2 (or whatever you like) considered
to be a streaked star
a_threshold = 1.2
For i = 1, n_areas - 1 Do Begin
wa = Where(lab EQ w[i] + 1) ;+1 to compensate for the removed
background count
wx = wa Mod Dim[0] ;Find the x- and y-locations of the pixels
wy = wa / Mod[0]
;If your streaks are vertical, otherwise reverse wx and wy
aspect_ratio = (Max(wy) - Min(wy) + 1.0) / (Max(wx) - Min(wx) + 1.0)
If aspect_ration GT a_threshold Then Begin
;Do something to remove the streaks
EndIf
EndFor
I can't remember exactly how I removed the streaks. I think I
substituted the streak's pixels by pixel values that were found just
adjacent to the streak (left and right). I also added some random
noise to the pixels to make them less obvious.
I hope it helps.
Michael
|
|
|