Changeset 28149 for trunk/psLib/src/imageops/psImageCovariance.c
- Timestamp:
- May 27, 2010, 4:04:37 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
r28006 r28149 571 571 572 572 psKernel *out = psKernelAlloc(xMinOut, xMaxOut, yMinOut, yMaxOut); // Output covariance 573 double sum = 0.0; // Sum of covariance 573 574 for (int y = yMinOut; y <= yMaxOut; y++) { 574 575 float yIn = y * scale + 0.5 - yMinIn + 1; // Position on input image (not the kernel) … … 580 581 return false; 581 582 } 582 out->kernel[y][x] = value; 583 } 584 } 585 583 sum += out->kernel[y][x] = value; 584 } 585 } 586 586 psFree(interp); 587 588 float norm = 1.0 / PS_SQR(scale) / sum; // Renormalisation for covariance (to remove errors in interp.) 589 for (int y = yMinOut; y <= yMaxOut; y++) { 590 for (int x = xMinOut; x <= xMaxOut; x++) { 591 out->kernel[y][x] *= norm; 592 } 593 } 587 594 588 595 return out;
Note:
See TracChangeset
for help on using the changeset viewer.
