IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 23, 2013, 12:09:42 PM (13 years ago)
Author:
eugene
Message:

add gauss to 2d cache smooth; some test code in pmPCM_Minimize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psLib/src/imageops/psImageConvolve2dCache.c

    r36285 r36307  
    125125}
    126126
     127// generate a 2D smoothing kernel for supplied sigma & kappa (PS1_V1 profile). 
     128bool psImageSmooth2dCacheKernel_Gauss (psImageSmooth2dCacheData *smdata, float sigma) {
     129
     130    // check for NULL structure elements?
     131    int Ns = (int)(smdata->Nsigma * sigma);
     132    Ns = PS_MAX (3, PS_MIN (Ns, 10));
     133    smdata->Ns = Ns;
     134
     135    int Ns2 = Ns * Ns;
     136
     137    // we are going to use a hard-wired set of radial points
     138    smdata->radflux = psAlloc(sizeof(float)*NRAD_MAX);
     139
     140    float sum = 0.0;
     141    for (int i = 0; i < NRAD_MAX; i++) {
     142        if (radii2[i] > Ns2) {
     143            smdata->radflux[i] = 0.0;
     144            continue;
     145        }
     146        float z = 0.5 * radii2[i] / PS_SQR(sigma);
     147        smdata->radflux[i] = exp(-z);
     148        sum += radiiN[i] * smdata->radflux[i];
     149    }
     150    for (int i = 0; i < NRAD_MAX; i++) {
     151        smdata->radflux[i] = smdata->radflux[i] / sum;
     152    }
     153
     154    return true;
     155}
     156
    127157// we can use the same DATA structure on multiple images of the same size
    128158bool psImageSmooth2dCache_F32(psImage *image, psImageSmooth2dCacheData *smdata)
Note: See TracChangeset for help on using the changeset viewer.