Changeset 28151 for trunk/psLib/src/imageops/psImageCovariance.c
- Timestamp:
- May 27, 2010, 7:01:38 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageCovariance.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageCovariance.c
r28149 r28151 571 571 572 572 psKernel *out = psKernelAlloc(xMinOut, xMaxOut, yMinOut, yMaxOut); // Output covariance 573 double sum = 0.0;// Sum of covariance573 double outSum = 0.0; // Sum of covariance 574 574 for (int y = yMinOut; y <= yMaxOut; y++) { 575 575 float yIn = y * scale + 0.5 - yMinIn + 1; // Position on input image (not the kernel) … … 581 581 return false; 582 582 } 583 sum += out->kernel[y][x] = value;583 outSum += out->kernel[y][x] = value; 584 584 } 585 585 } 586 586 psFree(interp); 587 587 588 float norm = 1.0 / PS_SQR(scale) / sum; // Renormalisation for covariance (to remove errors in interp.) 588 double inSum = 0.0; // Sum of covariance 589 for (int y = yMinIn; y <= yMaxIn; y++) { 590 for (int x = xMinIn; x <= xMaxIn; x++) { 591 inSum += in->kernel[y][x]; 592 } 593 } 594 595 float norm = inSum / PS_SQR(scale) / outSum; // Renormalisation (to remove errors in interp.) 589 596 for (int y = yMinOut; y <= yMaxOut; y++) { 590 597 for (int x = xMinOut; x <= xMaxOut; x++) {
Note:
See TracChangeset
for help on using the changeset viewer.
