Changeset 28150 for trunk/psModules/src/imcombine/pmSubtraction.c
- Timestamp:
- May 27, 2010, 5:54:44 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmSubtraction.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtraction.c
r27086 r28150 32 32 #define MIN_SAMPLE_STATS 7 // Minimum number to use sample statistics; otherwise use quartiles 33 33 #define USE_KERNEL_ERR // Use kernel error image? 34 #define NUM_COVAR_POS 5 // Number of positions for covariance calculation 34 35 35 36 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 1328 1329 // This can be fairly involved, so we only do it for a single instance 1329 1330 // Enable threads for covariance calculation, since we're not threading on top of it. 1331 float position[NUM_COVAR_POS] = { -1.0, -0.5, 0.0, +0.5, +1.0 }; // Positions for covariance calculations 1330 1332 oldThreads = psImageCovarianceSetThreads(true); 1331 1333 if (kernels->mode == PM_SUBTRACTION_MODE_1 || kernels->mode == PM_SUBTRACTION_MODE_DUAL) { 1332 psKernel *kernel = pmSubtractionKernel(kernels, 0.0, 0.0, false); // Convolution kernel 1333 psKernelTruncate(kernel, covarFrac); 1334 out1->covariance = psImageCovarianceCalculate(kernel, ro1->covariance); 1335 psFree(kernel); 1334 psArray *covars = psArrayAlloc(PS_SQR(NUM_COVAR_POS)); // Covariances 1335 for (int y = 0, i = 0; y < NUM_COVAR_POS; y++) { 1336 for (int x = 0; x < NUM_COVAR_POS; x++, i++) { 1337 psKernel *kernel = pmSubtractionKernel(kernels, position[x], position[y], 1338 false); // Convolution kernel 1339 psKernelTruncate(kernel, covarFrac); 1340 covars->data[i] = psImageCovarianceCalculate(kernel, ro1->covariance); 1341 psFree(kernel); 1342 } 1343 } 1344 out1->covariance = psImageCovarianceAverage(covars); 1345 psFree(covars); 1336 1346 } 1337 1347 if (kernels->mode == PM_SUBTRACTION_MODE_2 || kernels->mode == PM_SUBTRACTION_MODE_DUAL) { 1338 psKernel *kernel = pmSubtractionKernel(kernels, 0.0, 0.0, 1339 kernels->mode == PM_SUBTRACTION_MODE_DUAL); // Conv. kernel 1340 psKernelTruncate(kernel, covarFrac); 1341 out2->covariance = psImageCovarianceCalculate(kernel, ro2->covariance); 1342 psFree(kernel); 1348 psArray *covars = psArrayAlloc(PS_SQR(NUM_COVAR_POS)); // Covariances 1349 for (int y = 0, i = 0; y < NUM_COVAR_POS; y++) { 1350 for (int x = 0; x < NUM_COVAR_POS; x++, i++) { 1351 psKernel *kernel = pmSubtractionKernel(kernels, position[x], position[y], 1352 kernels->mode == PM_SUBTRACTION_MODE_DUAL); // Convolution kernel 1353 psKernelTruncate(kernel, covarFrac); 1354 covars->data[i] = psImageCovarianceCalculate(kernel, ro2->covariance); 1355 psFree(kernel); 1356 } 1357 } 1358 out2->covariance = psImageCovarianceAverage(covars); 1359 psFree(covars); 1343 1360 } 1344 1361 psImageCovarianceSetThreads(oldThreads);
Note:
See TracChangeset
for help on using the changeset viewer.
