IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 28, 2013, 4:10:42 AM (13 years ago)
Author:
eugene
Message:

extended 2d cached-convolution to 15 pix radius

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psLib/test/imageops/tap_psImageConvolve2dCache.c

    r36282 r36319  
    1414#include "pstap.h"
    1515
    16 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa);
     16bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float Nsigma, float sigma, float kappa);
    1717
    1818int main(int argc, char **argv) {
     
    2323
    2424    // generate an image to convolve
    25     tap_convolve_delta (301, 301, 150, 150, 2.0, 1.0);
    26     tap_convolve_delta (301, 301, 100, 200, 2.0, 1.0);
    27     tap_convolve_delta (301, 301, 200, 100, 2.0, 1.0);
    28     tap_convolve_delta (301, 301, 200, 200, 2.0, 1.0);
    29     tap_convolve_delta (301, 301, 100, 100, 2.0, 1.0);
     25    tap_convolve_delta (301, 301, 150, 150, 3.0, 2.0, 1.0);
     26    tap_convolve_delta (301, 301, 100, 200, 3.0, 2.0, 1.0);
     27    tap_convolve_delta (301, 301, 200, 100, 3.0, 2.0, 1.0);
     28    tap_convolve_delta (301, 301, 200, 200, 3.0, 2.0, 1.0);
     29    tap_convolve_delta (301, 301, 100, 100, 3.0, 2.0, 1.0);
    3030
    31     tap_convolve_delta (301, 301, 150, 150, 3.0, 1.0);
    32     tap_convolve_delta (301, 301, 100, 200, 3.0, 1.0);
    33     tap_convolve_delta (301, 301, 200, 100, 3.0, 1.0);
    34     tap_convolve_delta (301, 301, 200, 200, 3.0, 1.0);
    35     tap_convolve_delta (301, 301, 100, 100, 3.0, 1.0);
     31    tap_convolve_delta (301, 301, 150, 150, 3.0, 3.0, 1.0);
     32    tap_convolve_delta (301, 301, 100, 200, 3.0, 3.0, 1.0);
     33    tap_convolve_delta (301, 301, 200, 100, 3.0, 3.0, 1.0);
     34    tap_convolve_delta (301, 301, 200, 200, 3.0, 3.0, 1.0);
     35    tap_convolve_delta (301, 301, 100, 100, 3.0, 3.0, 1.0);
    3636
    37     tap_convolve_delta (301, 301, 150, 150, 1.0, 1.0);
    38     tap_convolve_delta (301, 301, 100, 200, 1.0, 1.0);
    39     tap_convolve_delta (301, 301, 200, 100, 1.0, 1.0);
    40     tap_convolve_delta (301, 301, 200, 200, 1.0, 1.0);
    41     tap_convolve_delta (301, 301, 100, 100, 1.0, 1.0);
     37    tap_convolve_delta (301, 301, 150, 150, 3.0, 1.0, 1.0);
     38    tap_convolve_delta (301, 301, 100, 200, 3.0, 1.0, 1.0);
     39    tap_convolve_delta (301, 301, 200, 100, 3.0, 1.0, 1.0);
     40    tap_convolve_delta (301, 301, 200, 200, 3.0, 1.0, 1.0);
     41    tap_convolve_delta (301, 301, 100, 100, 3.0, 1.0, 1.0);
    4242
    43     tap_convolve_delta (301, 301, 150, 150, 2.0, 2.0);
    44     tap_convolve_delta (301, 301, 100, 200, 2.0, 2.0);
    45     tap_convolve_delta (301, 301, 200, 100, 2.0, 2.0);
    46     tap_convolve_delta (301, 301, 200, 200, 2.0, 2.0);
    47     tap_convolve_delta (301, 301, 100, 100, 2.0, 2.0);
     43    tap_convolve_delta (301, 301, 150, 150, 3.0, 2.0, 2.0);
     44    tap_convolve_delta (301, 301, 100, 200, 3.0, 2.0, 2.0);
     45    tap_convolve_delta (301, 301, 200, 100, 3.0, 2.0, 2.0);
     46    tap_convolve_delta (301, 301, 200, 200, 3.0, 2.0, 2.0);
     47    tap_convolve_delta (301, 301, 100, 100, 3.0, 2.0, 2.0);
     48
     49    tap_convolve_delta (301, 301, 150, 150, 4.0, 3.0, 1.0);
     50    tap_convolve_delta (301, 301, 100, 200, 4.0, 3.0, 1.0);
     51    tap_convolve_delta (301, 301, 200, 100, 4.0, 3.0, 1.0);
     52    tap_convolve_delta (301, 301, 200, 200, 4.0, 3.0, 1.0);
     53    tap_convolve_delta (301, 301, 100, 100, 4.0, 3.0, 1.0);
     54
     55    tap_convolve_delta (301, 301, 150, 150, 5.0, 3.0, 1.0);
     56    tap_convolve_delta (301, 301, 100, 200, 5.0, 3.0, 1.0);
     57    tap_convolve_delta (301, 301, 200, 100, 5.0, 3.0, 1.0);
     58    tap_convolve_delta (301, 301, 200, 200, 5.0, 3.0, 1.0);
     59    tap_convolve_delta (301, 301, 100, 100, 5.0, 3.0, 1.0);
     60
     61    tap_convolve_delta (301, 301, 150, 150, 5.0, 1.0, 1.0);
     62    tap_convolve_delta (301, 301, 100, 200, 5.0, 1.0, 1.0);
     63    tap_convolve_delta (301, 301, 200, 100, 5.0, 1.0, 1.0);
     64    tap_convolve_delta (301, 301, 200, 200, 5.0, 1.0, 1.0);
     65    tap_convolve_delta (301, 301, 100, 100, 5.0, 1.0, 1.0);
    4866
    4967    ok(!psMemCheckLeaks (id, NULL, stdout, false), "no memory leaks");
     
    5270}
    5371
    54 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa) {
     72bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float Nsigma, float sigma, float kappa) {
    5573
    5674    bool status;
     
    6078    input->data.F32[Yo][Xo] = 1.0;
    6179
    62     psImageSmooth2dCacheData *smdata = psImageSmooth2dCacheAlloc (3.0);
     80    psImageSmooth2dCacheData *smdata = psImageSmooth2dCacheAlloc (Nsigma);
    6381    ok(smdata, "init smdata");
    6482    ok(!smdata->radflux, "init radflux to NULL");
    65     ok(smdata->Nsigma == 3, "init Nsigma to 3");
     83    ok(smdata->Nsigma == Nsigma, "init Nsigma");
    6684   
    6785    status = psImageSmooth2dCacheKernel_PS1_V1 (smdata, sigma, kappa);
     
    7189    ok(status, "smoothed image");
    7290   
    73     float s = 0.0;
     91    double s = 0.0;
    7492
    7593    psImage *model = psImageAlloc (Nx, Ny, PS_TYPE_F32);
     
    7795    for (int iy = 0; iy < model->numRows; iy++) {
    7896        for (int ix = 0; ix < model->numCols; ix++) {
    79             float z = PS_SQR((ix + 0.5 - Xo - 0.5) / sigma) + PS_SQR((iy + 0.5 - Yo - 0.5) / sigma);
    80             if (z > PS_SQR(smdata->Nsigma)) continue;
     97            float z = 0.5*PS_SQR((ix + 0.5 - Xo - 0.5) / sigma) + 0.5*PS_SQR((iy + 0.5 - Yo - 0.5) / sigma);
     98            if (z > 0.5*PS_SQR(smdata->Nsigma)) continue;
    8199           
    82100            float f = 1.0 / (1.0 + z*kappa + pow(z, 1.666));
     
    101119        }
    102120    }
    103     ok (fabs(min_df) < 1e-5, "minor deviations");
    104     ok (fabs(max_df) < 1e-5, "minor deviations");
     121    ok (fabs(min_df) < 3e-5, "minor deviations");
     122    ok (fabs(max_df) < 3e-5, "minor deviations");
    105123
    106     if ((fabs(min_df) >= 1e-5) || (fabs(max_df) >= 1e-5)) {
     124    if ((fabs(min_df) >= 3e-5) || (fabs(max_df) >= 3e-5)) {
    107125        psFits *fits = NULL;
    108126        fits = psFitsOpen ("input.fits", "w");
Note: See TracChangeset for help on using the changeset viewer.