Changeset 28301
- Timestamp:
- Jun 10, 2010, 4:18:42 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackTarget.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackTarget.c
r28256 r28301 164 164 165 165 psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for background 166 float mean = NAN; // Measured mean variance 166 167 if (!psImageBackground(bg, NULL, variance, mask, maskVal, rng)) { 167 psError(PPSTACK_ERR_DATA, false, "Can't measure background for image."); 168 psFree(rng); 169 return NULL; 168 psErrorClear(); 169 // Retry using all the available pixels 170 bg->nSubsample = variance->numCols * variance->numRows + 1; 171 if (!psImageStats(bg, variance, mask, maskVal)) { 172 psLogMsg("ppStack", PS_LOG_DETAIL, 173 "Couldn't measure mean variance for image %d; retrying.", i); 174 psErrorClear(); 175 // Retry with desperate statistic 176 bg->options = PS_STAT_SAMPLE_MEAN; 177 if (!psImageStats(bg, variance, mask, maskVal)) { 178 psError(PPSTACK_ERR_DATA, false, "Unable to measure mean variance for image %d", i); 179 psFree(rng); 180 psFree(bg); 181 return NULL; 182 } else { 183 // Desperate retry 184 mean = bg->sampleMean; 185 } 186 } else { 187 // Retry with all available pixels 188 mean = bg->robustMedian; 189 } 190 } else { 191 // First attempt 192 mean = bg->robustMedian; 170 193 } 171 194
Note:
See TracChangeset
for help on using the changeset viewer.
