IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26553


Ignore:
Timestamp:
Jan 8, 2010, 4:52:28 PM (16 years ago)
Author:
Paul Price
Message:

Use second moment as penalty, so that odd functions have penalty too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psModules/src/imcombine/pmSubtractionKernels.c

    r26547 r26553  
    154154        for (int u = -size; u <= size; u++) {
    155155            double value = preCalc->kernel->kernel[v][u];
    156             moment += value * PS_SQR((PS_SQR(u) + PS_SQR(v)));
     156            moment += PS_SQR(value) * PS_SQR((PS_SQR(u) + PS_SQR(v)));
    157157        }
    158158    }
     
    181181    // only even terms have non-zero sums
    182182    if ((uOrder % 2 == 0) && (vOrder % 2 == 0)) {
    183         moment /= sum;
    184     } else {
    185         moment = 0.0;
     183        moment /= PS_SQR(sum);
    186184    }
    187185
     
    231229    kernels->preCalc->data[index] = preCalc;
    232230    kernels->penalties->data.F32[index] = kernels->penalty * fabsf(moment);
    233     if (!isfinite(kernels->penalties->data.F32[index])) {
    234         psAbort ("invalid penalty");
    235     }
    236231
    237232    psTrace("psModules.imcombine", 7, "Kernel %d: %f %d %d %f\n", index,
     
    893888                                    preCalc->poly->data.F32[j] = polyVal;
    894889                                    norm += polyVal;
    895                                     moment += polyVal * PS_SQR(PS_SQR(u) + PS_SQR(v));
     890                                    moment += PS_SQR(polyVal) * PS_SQR(PS_SQR(u) + PS_SQR(v));
    896891
    897892                                    psVectorExtend(preCalc->uCoords, RINGS_BUFFER, 1);
     
    919914                        psBinaryOp(preCalc->poly, preCalc->poly, "*", psScalarAlloc(1.0 / norm, PS_TYPE_F32));
    920915                    }
    921                     moment /= norm;
     916                    moment /= PS_SQR(norm);
    922917                }
    923918
Note: See TracChangeset for help on using the changeset viewer.