IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 22, 2005, 4:20:27 PM (21 years ago)
Author:
eugene
Message:

various cleanups, fixes, additions...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotBasicDeblend.c

    r5772 r5828  
    88    pmSource *source, *testSource;
    99
    10     FILE *f = fopen ("deblend.dat", "w");
    11     if (f == NULL) psAbort ("psphot", "can't open deblend.dat output file");
    1210    int Nblend = 0;
    1311
     
    8280            // XXX EAM : should the contour input coordinate be in parent or subimage coords? parent, for now
    8381            psArray *contour = pmSourceContour_EAM (source->pixels, source->peak->x, source->peak->y, threshold);
    84             if (contour == NULL) {
    85                 fprintf (stderr, "below threshold? invalid peak?\n");
    86                 continue;
    87             }
     82            if (contour == NULL) continue;
    8883
    8984            // the source contour consists of two vectors, xv and yv.  the contour is
     
    10297                    if (xv->data.F32[j+1] < testSource->peak->x) break;
    10398
     99                    # if (0)
    104100                    int xp0 = source->moments->x - source->pixels->col0;
    105101                    int xp1 = source->peak->x - source->pixels->col0;
     
    111107                    int yp2 = testSource->moments->y - testSource->pixels->row0;
    112108                    int yp3 = testSource->peak->y - testSource->pixels->row0;
     109                   
     110                    fprintf (f, "%d %d (%f, %f) :  %d %d (%f, %f)  vs %f\n",
     111                             source->peak->x, source->peak->y,
     112                             source->pixels->data.F32[yp0][xp0], source->pixels->data.F32[yp1][xp1],
     113                             testSource->peak->x, testSource->peak->y,
     114                             testSource->pixels->data.F32[yp2][xp2], testSource->pixels->data.F32[yp3][xp3], threshold
     115                       );
     116                    # endif
     117                   
     118                    testSource->mode |= PM_SOURCE_BLEND;
    113119
    114                     fprintf (f, "%d %d (%f, %f) :  %d %d (%f, %f)  vs %f\n",
    115                              source->peak->x, source->peak->y,
    116                              source->pixels->data.F32[yp0][xp0], source->pixels->data.F32[yp1][xp1],
    117                              testSource->peak->x, testSource->peak->y,
    118                              testSource->pixels->data.F32[yp2][xp2], testSource->pixels->data.F32[yp3][xp3], threshold
    119                              );
     120                    // add this to the list of source->blends
     121                    if (source->blends == NULL) {
     122                        source->blends = psArrayAlloc (16);
     123                        source->blends->n = 0;
     124                    }
     125                    psArrayAdd (source->blends, 16, testSource);
    120126
    121                     testSource->mode |= PM_SOURCE_BLEND;
    122127                    Nblend ++;
    123128                    j = xv->n;
     
    126131        }
    127132    }
    128     fclose (f);
    129     psLogMsg ("psphot.deblend", 3, "identified %d blended objects (%f)\n", Nblend, psTimerMark ("psphot"));
     133    psLogMsg ("psphot.deblend", 3, "identified %d blended objects (%f sec)\n", Nblend, psTimerMark ("psphot"));
    130134    return true;
    131135}
    132 
    133 
    134 
Note: See TracChangeset for help on using the changeset viewer.