Changeset 21477 for trunk/ppStack/src/ppStackMatch.c
- Timestamp:
- Feb 13, 2009, 1:53:56 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackMatch.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackMatch.c
r21366 r21477 170 170 assert(kernels && !*kernels); 171 171 assert(config); 172 *weighting = 0.0; 172 173 173 174 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe … … 260 261 pmSubtractionAnalysis(readout->analysis, kernels, region, 261 262 readout->image->numCols, readout->image->numRows); 263 264 psKernel *kernel = pmSubtractionKernel(kernels, 0.0, 0.0, false); // Convolution kernel 265 psKernel *covar = psImageCovarianceCalculate(kernel, readout->covariance); // New covariance matrix 266 psFree(readout->covariance); 267 readout->covariance = covar; 268 psFree(kernel); 269 262 270 } else { 263 271 #endif … … 541 549 } 542 550 psFree(iter); 543 *chi2 /= num;551 *chi2 /= psImageCovarianceFactor(readout->covariance) * num; 544 552 } 545 553 … … 579 587 (void)psBinaryOp(readout->image, readout->image, "-", 580 588 psScalarAlloc(psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN), PS_TYPE_F32)); 581 *weighting = 1.0 / PS_SQR(psStatsGetValue(bg, PS_STAT_ROBUST_STDEV)); 582 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "PPSTACK.WEIGHTING", 0, 583 "Weighting by 1/noise^2 for stack", 584 1.0 / PS_SQR(psStatsGetValue(bg, PS_STAT_ROBUST_STDEV))); 585 } 589 } 590 591 // Measure the variance level for the weighting 592 if (!psImageBackground(bg, NULL, readout->variance, readout->mask, maskVal | maskBad, rng)) { 593 psError(PS_ERR_UNKNOWN, false, "Can't measure mean variance for image."); 594 psFree(output); 595 return false; 596 } 597 *weighting = 1.0 / (psStatsGetValue(bg, PS_STAT_ROBUST_MEDIAN) * 598 psImageCovarianceFactor(readout->covariance)); 599 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "PPSTACK.WEIGHTING", 0, 600 "Weighting by 1/noise^2 for stack", *weighting); 601 586 602 psFree(bg); 587 603
Note:
See TracChangeset
for help on using the changeset viewer.
