Changeset 10026
- Timestamp:
- Nov 16, 2006, 3:18:05 PM (20 years ago)
- Location:
- trunk/psModules/src/detrend
- Files:
-
- 2 edited
-
pmMaskBadPixels.c (modified) (1 diff)
-
pmMaskBadPixels.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmMaskBadPixels.c
r10022 r10026 165 165 } 166 166 167 float target = histo->nums->data.F32[0] * powf(10.0, thresh); // Level to which histogram must fall 168 int index; 169 for (index = 0; histo->nums->data.F32[index] > target && index < histo->nums->n; index++) 170 ; 171 limit = histo->bounds->data.F32[index]; 167 // Find the mode. Since this is a Poisson distribution (more or less), this should also be the mean 168 // and variance. 169 int max = 0; // Index of the mode 170 for (int i = 0; i < histo->nums->n; i++) { 171 if (histo->nums->data.F32[i] > histo->nums->data.F32[max]) { 172 max = i; 173 } 174 } 175 176 // Since the mode is most likely zero, we add one to get something realistic. Then "thresh" is 177 // negative, so we subtract instead of add. 178 limit = max + 1.0 - thresh * sqrtf((float)max + 1.0); 179 172 180 } else { 173 181 psError(PS_ERR_BAD_PARAMETER_VALUE, true, -
trunk/psModules/src/detrend/pmMaskBadPixels.h
r10023 r10026 8 8 /// @author Eugene Magnier, IfA 9 9 /// 10 /// @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $11 /// @date $Date: 2006-11-17 0 0:50:39 $10 /// @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 11 /// @date $Date: 2006-11-17 01:17:59 $ 12 12 /// 13 13 /// Copyright 2004 Institute for Astronomy, University of Hawaii … … 51 51 /// Bad pixels are identified from the suspect pixels image (accumulated over a large number of images). 52 52 /// Pixels marked as suspect in more than "thresh" standard deviations from the mean are identified as bad 53 /// pixels (output image). If "thresh" is negative, it is interpreted as a (base 10) logarithm of the 54 /// fraction by which the number of pixels marked that many times must drop compared to the number of pixels 55 /// with zero. 53 /// pixels (output image). If "thresh" is negative, a Poisson is assumed. 56 54 psImage *pmMaskIdentifyBadPixels(const psImage *suspects, ///< Accumulated suspect pixels image 57 55 float thresh, ///< Threshold for bad pixel (standard deviations)
Note:
See TracChangeset
for help on using the changeset viewer.
