Changeset 21406
- Timestamp:
- Feb 6, 2009, 3:54:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_20090128/psModules/src/imcombine/pmSubtraction.c
r21303 r21406 48 48 49 49 // Take the square of the normal kernel 50 double sum Normal = 0.0, sumVariance = 0.0; // Sum of the normal and variance kernels50 double sumVariance = 0.0; // Sum of the variance kernel 51 51 for (int v = yMin; v <= yMax; v++) { 52 52 for (int u = xMin; u <= xMax; u++) { 53 float value = normalKernel->kernel[v][u]; // Value of interest 54 float value2 = PS_SQR(value); // Value squared 55 sumNormal += value; 53 float value2 = PS_SQR(normalKernel->kernel[v][u]); // Value squared 56 54 sumVariance += value2; 57 55 out->kernel[v][u] = value2; … … 59 57 } 60 58 61 // Normalise so that the sum of the variance kernel is the square of the sum of the normal kernel 62 // This is required to keep the relative scaling between the image and the variance map 63 psBinaryOp(out->image, out->image, "*", psScalarAlloc(PS_SQR(sumNormal) / sumVariance, PS_TYPE_F32)); 59 psBinaryOp(out->image, out->image, "*", psScalarAlloc(1.0 / sumVariance, PS_TYPE_F32)); 64 60 65 61 return out;
Note:
See TracChangeset
for help on using the changeset viewer.
