Changeset 6891 for trunk/pois/src/poisCheckKernel.c
- Timestamp:
- Apr 18, 2006, 12:42:12 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/pois/src/poisCheckKernel.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pois/src/poisCheckKernel.c
r4700 r6891 4 4 5 5 bool poisCheckKernel(const psVector *solution,// Kernel solution 6 const psArray *kernels, // Kernel basis functions7 const poisConfig *config // Configuration6 const psArray *kernels, // Kernel basis functions 7 const poisConfig *config // Configuration 8 8 ) 9 9 { … … 13 13 psVector *radKernel = psVectorAlloc((2*config->xKernel + 1) * (2*config->yKernel + 1), PS_TYPE_F32); 14 14 psVector *radii = psVectorAlloc((2*config->xKernel + 1) * (2*config->yKernel + 1), PS_TYPE_F32); // Radius 15 radKernel->n = radii->n = (2*config->xKernel + 1) * (2*config->yKernel + 1); 15 16 for (int i = 0; i < solution->n - 1; i++) { 16 poisKernelBasis *kernel = kernels->data[i]; // The kernel basis function17 if (kernel->xOrder == 0 && kernel->yOrder == 0) {18 int u = kernel->u;// x offset19 int v = kernel->v;// y offset20 float distance = sqrtf((float)(u*u) + (float)(v*v)); // Distance from the centre21 radKernel->data.F32[i] = solution->data.F64[i];22 radii->data.F32[i] = distance;23 }17 poisKernelBasis *kernel = kernels->data[i]; // The kernel basis function 18 if (kernel->xOrder == 0 && kernel->yOrder == 0) { 19 int u = kernel->u; // x offset 20 int v = kernel->v; // y offset 21 float distance = sqrtf((float)(u*u) + (float)(v*v)); // Distance from the centre 22 radKernel->data.F32[i] = solution->data.F64[i]; 23 radii->data.F32[i] = distance; 24 } 24 25 } 25 26 26 27 psVector *sortIndex = psVectorSortIndex(NULL, radii); // Indices from sort 27 float distance = 0.0; // Distance from the centre that's being examined28 float sum = 0.0; // Sum of kernel for that distance29 int num = 0; // Number of pixels at that distance28 float distance = 0.0; // Distance from the centre that's being examined 29 float sum = 0.0; // Sum of kernel for that distance 30 int num = 0; // Number of pixels at that distance 30 31 int centreIndex = sortIndex->data.U32[0]; // Index of the centre pixel 31 int numSuspect = 0; // Number of radii considered suspect32 int numSuspect = 0; // Number of radii considered suspect 32 33 for (int i = 0; i < (2*config->xKernel + 1) * (2*config->yKernel + 1); i++) { 33 unsigned int index = sortIndex->data.U32[i];34 if (radii->data.F32[index] != distance) {35 psTrace("pois.checkKernel", 7, "Radius: %f\tMean: %f\n", distance, sum/(float)num);36 if (fabs(distance*sum/(float)num) > radKernel->data.F32[centreIndex]) {37 numSuspect++;38 }39 sum = 0.0;40 num = 0;41 distance = radii->data.F32[index];42 }43 sum += radKernel->data.F32[index];44 num++;34 unsigned int index = sortIndex->data.U32[i]; 35 if (radii->data.F32[index] != distance) { 36 psTrace("pois.checkKernel", 7, "Radius: %f\tMean: %f\n", distance, sum/(float)num); 37 if (fabs(distance*sum/(float)num) > radKernel->data.F32[centreIndex]) { 38 numSuspect++; 39 } 40 sum = 0.0; 41 num = 0; 42 distance = radii->data.F32[index]; 43 } 44 sum += radKernel->data.F32[index]; 45 num++; 45 46 } 46 47 psTrace("pois.checkKernel", 7, "Radius: %f\tMean: %f\n", distance, sum/(float)num); 47 48 if (fabs(distance*sum/(float)num) > radKernel->data.F32[centreIndex]) { 48 numSuspect++;49 numSuspect++; 49 50 } 50 51 … … 56 57 57 58 if (numSuspect > 0) { 58 psWarning("There is significant power at large radii. The kernel may be bad.\n");59 return false;59 psWarning("There is significant power at large radii. The kernel may be bad.\n"); 60 return false; 60 61 } 61 62
Note:
See TracChangeset
for help on using the changeset viewer.
