Changeset 18287 for trunk/psModules/src/imcombine/pmSubtractionEquation.c
- Timestamp:
- Jun 23, 2008, 12:41:08 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtractionEquation.c
r17825 r18287 30 30 for (int y = - footprint; y <= footprint; y++) { 31 31 for (int x = - footprint; x <= footprint; x++) { 32 sum += image1->kernel[y][x] * image2->kernel[y][x] / weight->kernel[y][x];32 sum += image1->kernel[y][x] * image2->kernel[y][x] / 1.0; // weight->kernel[y][x]; 33 33 } 34 34 } … … 194 194 for (int y = - footprint; y <= footprint; y++) { 195 195 for (int x = - footprint; x <= footprint; x++) { 196 sumC += conv->kernel[y][x] / weight->kernel[y][x];196 sumC += conv->kernel[y][x] / 1.0; // weight->kernel[y][x]; 197 197 } 198 198 } … … 217 217 for (int y = - footprint; y <= footprint; y++) { 218 218 for (int x = - footprint; x <= footprint; x++) { 219 double invNoise2 = 1.0 / weight->kernel[y][x];219 double invNoise2 = 1.0 / 1.0; // weight->kernel[y][x]; 220 220 double value = input->kernel[y][x] * invNoise2; 221 221 sumI += value; … … 276 276 for (int y = - footprint; y <= footprint; y++) { 277 277 for (int x = - footprint; x <= footprint; x++) { 278 sumTC += target->kernel[y][x] * conv->kernel[y][x]/ weight->kernel[y][x];278 sumTC += target->kernel[y][x] * conv->kernel[y][x] / 1.0; // weight->kernel[y][x]; 279 279 } 280 280 } … … 296 296 for (int y = - footprint; y <= footprint; y++) { 297 297 for (int x = - footprint; x <= footprint; x++) { 298 float value = target->kernel[y][x] / weight->kernel[y][x];298 float value = target->kernel[y][x] / 1.0; // weight->kernel[y][x]; 299 299 sumIT += value * input->kernel[y][x]; 300 300 sumT += value; … … 365 365 for (int y = - footprint; y <= footprint; y++) { 366 366 for (int x = - footprint; x <= footprint; x++) { 367 sumC += conv->kernel[y][x] / weight->kernel[y][x];367 sumC += conv->kernel[y][x] / 1.0; // weight->kernel[y][x]; 368 368 } 369 369 } … … 382 382 } 383 383 384 385 // Add in penalty term to least-squares vector 386 static bool calculatePenalty(psVector *vector, // Vector to which to add in penalty term 387 const pmSubtractionKernels *kernels // Kernel parameters 388 ) 389 { 390 if (kernels->penalty == 0.0) { 391 return true; 392 } 393 394 psVector *penalties = kernels->penalties; // Penalties for each kernel component 395 int spatialOrder = kernels->spatialOrder; // Order of spatial variations 396 int numKernels = kernels->num; // Number of kernel components 397 for (int i = 0; i < numKernels; i++) { 398 for (int yOrder = 0, index = i; yOrder <= spatialOrder; yOrder++) { 399 for (int xOrder = 0; xOrder <= spatialOrder - yOrder; xOrder++, index += numKernels) { 400 vector->data.F64[index] -= penalties->data.F32[i]; 401 } 402 } 403 } 404 405 return true; 406 } 407 384 408 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 385 409 // Semi-public functions 386 // XXX EAM these cannot be inline :: talk to Josh 410 // XXX We might like to define these functions as "extern inline" but gcc currently doesn't handle this in c99 411 // mode. See http://gcc.gnu.org/ml/gcc/2006-11/msg00006.html 387 412 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 388 413 … … 675 700 psVectorInit(sumVector, 0.0); 676 701 psImageInit(sumMatrix, 0.0); 702 int numStamps = 0; // Number of good stamps 677 703 for (int i = 0; i < stamps->num; i++) { 678 704 pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest … … 680 706 (void)psBinaryOp(sumMatrix, sumMatrix, "+", stamp->matrix1); 681 707 (void)psBinaryOp(sumVector, sumVector, "+", stamp->vector1); 682 } 683 } 708 numStamps++; 709 } 710 } 711 calculatePenalty(sumVector, kernels); 684 712 685 713 psVector *permutation = NULL; // Permutation vector, required for LU decomposition … … 716 744 psVectorInit(sumVector2, 0.0); 717 745 746 int numStamps = 0; // Number of good stamps 718 747 for (int i = 0; i < stamps->num; i++) { 719 748 pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest … … 724 753 (void)psBinaryOp(sumVector1, sumVector1, "+", stamp->vector1); 725 754 (void)psBinaryOp(sumVector2, sumVector2, "+", stamp->vector2); 726 } 727 } 755 numStamps++; 756 } 757 } 758 calculatePenalty(sumVector1, kernels); 759 calculatePenalty(sumVector2, kernels); 728 760 729 761 #if 0 … … 778 810 psImage *F = (psImage*)psBinaryOp(NULL, CtBiC, "-", A); 779 811 assert(F->numRows == numParams && F->numCols == numParams); 780 float det = NAN;812 float det = 0.0; 781 813 psImage *Fi = psMatrixInvert(NULL, F, &det); 782 814 assert(Fi->numRows == numParams && Fi->numCols == numParams);
Note:
See TracChangeset
for help on using the changeset viewer.
