Changeset 25841
- Timestamp:
- Oct 14, 2009, 12:50:17 PM (17 years ago)
- Location:
- branches/pap/psModules/src/imcombine
- Files:
-
- 4 edited
-
pmSubtraction.c (modified) (7 diffs)
-
pmSubtractionAnalysis.c (modified) (1 diff)
-
pmSubtractionEquation.c (modified) (1 diff)
-
pmSubtractionKernels.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap/psModules/src/imcombine/pmSubtraction.c
r25834 r25841 70 70 const pmSubtractionKernels *kernels, // Kernel basis functions 71 71 const psImage *polyValues, // Spatial polynomial values 72 bool normalise, // Add normalisation? 72 73 bool wantDual // Want the dual (second) kernel? 73 74 ) … … 178 179 } 179 180 180 // Put in the normalisation component 181 kernel->kernel[0][0] += (wantDual ? 1.0 : p_pmSubtractionSolutionNorm(kernels)); 181 if (normalise) { 182 // Put in the normalisation component 183 kernel->kernel[0][0] += (wantDual ? 1.0 : p_pmSubtractionSolutionNorm(kernels)); 184 } 182 185 183 186 return kernel; … … 349 352 ) 350 353 { 351 *kernelImage = solvedKernel(*kernelImage, kernels, polyValues, wantDual);354 *kernelImage = solvedKernel(*kernelImage, kernels, polyValues, true, wantDual); 352 355 if (variance || subMask) { 353 356 *kernelVariance = varianceKernel(*kernelVariance, *kernelImage); … … 466 469 psKernel *kernel; // Kernel to use 467 470 if (!preKernel) { 468 kernel = solvedKernel(NULL, kernels, polyValues, wantDual);471 kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual); 469 472 } else { 470 473 kernel = psMemIncrRefCounter(preKernel); … … 916 919 917 920 psImage *polyValues = p_pmSubtractionPolynomial(NULL, kernels->spatialOrder, x, y); // Solved polynomial 918 psKernel *kernel = solvedKernel(NULL, kernels, polyValues, wantDual); // The appropriate kernel921 psKernel *kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual); // The appropriate kernel 919 922 psFree(polyValues); 920 923 … … 947 950 psImage *polyValues = p_pmSubtractionPolynomial(NULL, kernels->spatialOrder, x, y); 948 951 949 psKernel *kernel = solvedKernel(NULL, kernels, polyValues, wantDual); // The appropriate kernel952 psKernel *kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual); // The appropriate kernel 950 953 psFree(polyValues); 951 954 … … 977 980 int num = wantDual ? solution->n - 1 : solution->n; // Number of kernel basis functions 978 981 979 psArray *images = psArrayAlloc(num); // Images of each kernel to return 982 psImage *polyValues = p_pmSubtractionPolynomial(NULL, kernels->spatialOrder, x, y); // Solved polynomial 983 psArray *images = psArrayAlloc(num + 1); // Images of each kernel to return 984 985 // The whole kernel 986 { 987 psKernel *kernel = solvedKernel(NULL, kernels, polyValues, true, wantDual); // The appropriate kernel 988 images->data[0] = psMemIncrRefCounter(kernel->image); 989 psFree(kernel); 990 } 991 992 // The parts 980 993 psVectorInit(solution, 0.0); 981 982 994 for (int i = 0; i < num; i++) { 983 995 solution->data.F64[i] = backup->data.F64[i]; 984 images->data[i] = pmSubtractionKernelImage(kernels, x, y, wantDual); 996 psKernel *kernel = solvedKernel(NULL, kernels, polyValues, false, wantDual); // The appropriate kernel 997 #if 0 998 int size = kernels->size; 999 double sum = 0.0; 1000 for (int v = -size; v <= size; v++) { 1001 for (int u = -size; u <= size; u++) { 1002 sum += kernel->kernel[v][u]; 1003 } 1004 } 1005 fprintf(stderr, "Kernel %d: %lf\n", i, sum); 1006 #endif 1007 images->data[i + 1] = psMemIncrRefCounter(kernel->image); 1008 psFree(kernel); 985 1009 solution->data.F64[i] = 0.0; 986 1010 } 1011 psFree(polyValues); 987 1012 psVectorCopy(solution, backup, PS_TYPE_F64); 988 1013 psFree(backup); -
branches/pap/psModules/src/imcombine/pmSubtractionAnalysis.c
r25834 r25841 16 16 #define KERNEL_MOSAIC 2 // Half-number of kernel instances in the mosaic image 17 17 18 //#define TESTING18 #define TESTING 19 19 20 20 bool pmSubtractionAnalysis(psMetadata *analysis, psMetadata *header, -
branches/pap/psModules/src/imcombine/pmSubtractionEquation.c
r25834 r25841 1388 1388 1389 1389 1390 #if 01390 #if 1 1391 1391 for (int i = 0; i < numParams; i++) { 1392 1392 double aVal1 = 0.0, bVal1 = 0.0; -
branches/pap/psModules/src/imcombine/pmSubtractionKernels.c
r25833 r25841 170 170 moment *= PS_SQR(sum); 171 171 } 172 173 174 #if 0 175 double sum = 0.0; // Sum of kernel component 176 for (int v = -size; v <= size; v++) { 177 for (int u = -size; u <= size; u++) { 178 sum += kernel->kernel[v][u]; 179 } 180 } 181 fprintf(stderr, "%d sum: %lf\n", index, sum); 182 #endif 172 183 173 184 kernels->widths->data.F32[index] = fwhms->data.F32[i];
Note:
See TracChangeset
for help on using the changeset viewer.
