Changeset 21291 for trunk/psLib/src/imageops/psImageCovariance.c
- Timestamp:
- Feb 4, 2009, 12:09:30 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageCovariance.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageCovariance.c
r21288 r21291 46 46 // covariance matrix and another kernel. This means that the resultant covariance matrix has twice the 47 47 // size of the kernel plus the size of the input covariance matrix. 48 49 // Covariance matrix for output 50 psKernel *out = psKernelAlloc(2 * kernel->xMin + covar->xMin, 2 * kernel->xMax + covar->xMax, 51 2 * kernel->yMin + covar->yMin, 2 * kernel->yMax + covar->yMax); 48 int xMin = kernel->xMin - kernel->xMax + covar->xMin, xMax = kernel->xMax - kernel->xMin + covar->xMax; 49 int yMin = kernel->yMin - kernel->yMax + covar->yMin, yMax = kernel->yMax - kernel->yMin + covar->yMax; 50 psKernel *out = psKernelAlloc(xMin, xMax, yMin, yMax); // Covariance matrix for output 52 51 53 52 // Need to go: … … 66 65 67 66 double total = 0.0; // Total covariance 68 for (int y = out->yMin; y <= out->yMax; y++) {67 for (int y = yMin; y <= yMax; y++) { 69 68 // Range for v 70 69 int vMin = PS_MAX(kernel->yMin + covar->yMin, y + kernel->yMin); 71 70 int vMax = PS_MIN(kernel->yMax + covar->yMax, y + kernel->yMax); 72 for (int x = out->xMin; x <= out->xMax; x++) {71 for (int x = xMin; x <= xMax; x++) { 73 72 // Range for u 74 73 int uMin = PS_MAX(kernel->xMin + covar->xMin, x + kernel->xMin);
Note:
See TracChangeset
for help on using the changeset viewer.
