IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26805


Ignore:
Timestamp:
Feb 6, 2010, 1:59:52 PM (16 years ago)
Author:
eugene
Message:

pixel to index is -0.5 not +0.5

File:
1 edited

Legend:

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

    r26739 r26805  
    8989    *fluxStamp = -INFINITY;             // Flux of best stamp
    9090
     91    // fprintf (stderr, "xMin, xMax: %d, %d -> ", xMin, xMax);
     92
    9193    // Ensure we're not going to go outside the bounds of the image
    9294    xMin = PS_MAX(border, xMin);
     
    9496    yMin = PS_MAX(border, yMin);
    9597    yMax = PS_MIN(numRows - border - 1, yMax);
     98
     99    if (xMax < xMin) return false;
     100    if (yMax < yMin) return false;
     101
     102    psAssert (xMin <= xMax, "x mismatch?");
     103    psAssert (yMin <= yMax, "y mismatch?");
    96104
    97105    for (int y = yMin; y <= yMax; y++) {
     
    425433
    426434                    // Search bounds
    427                     int xCentre = xList->data.F32[j] + 0.5, yCentre = yList->data.F32[j] + 0.5;// Stamp centre
     435                    int xCentre = xList->data.F32[j] - 0.5, yCentre = yList->data.F32[j] - 0.5;// Stamp centre
    428436                    int search = footprint - size; // Search radius
    429437                    int xMin = PS_MAX(border, xCentre - search);
     
    434442                    goodStamp = stampSearch(&xStamp, &yStamp, &fluxStamp, image1, image2, thresh1, thresh2,
    435443                                            subMask, xMin, xMax, yMin, yMax, numCols, numRows, border);
     444                    // fprintf (stderr, "find: %d %d ==> %5.1f %5.1f (\n", xCentre, yCentre, xStamp, yStamp);
    436445#else
    437446                    // Only search the exact centre pixel
     
    440449                                            yList->data.F32[j], yList->data.F32[j], numCols, numRows, border);
    441450#endif
    442                     // fprintf (stderr, "find: %d %d ==> %5.1f %5.1f\n", xCentre, yCentre, xStamp, yStamp);
     451                    if (0 && goodStamp) {
     452                        fprintf (stderr, "find: %6.1f < %6.1f < %6.1f, %6.1f < %6.1f %6.1f\n",
     453                                 region->x0 + size, xStamp, region->x1 - size,
     454                                 region->y0 + size, yStamp, region->y1 - size);
     455                    }
    443456                }
    444457            } else {
     
    539552    for (int i = 0; i < numStars; i++) {
    540553        float xStamp = x->data.F32[i], yStamp = y->data.F32[i]; // Coordinates of stamp
    541         int xPix = xStamp + 0.5, yPix = yStamp + 0.5; // Pixel coordinate of stamp
     554        int xPix = xStamp - 0.5, yPix = yStamp - 0.5; // Pixel coordinate of stamp
    542555        if (!checkStampRegion(xPix, yPix, region)) {
    543556            // It's not in the big region
     
    768781                                            bounds.x0, bounds.x1, bounds.y0, bounds.y1);
    769782
    770         int x = stamp->x + 0.5, y = stamp->y + 0.5; // Stamp coordinates
     783        int x = stamp->x - 0.5, y = stamp->y - 0.5; // Stamp coordinates
     784        // fprintf (stderr, "stamp: %5.1f %5.1f == %d %d (size: %d)\n", stamp->x, stamp->y, x, y, size);
     785
    771786        if (x < bounds.x0 + size || x > bounds.x1 - size || y < bounds.y0 + size || y > bounds.y1 - size) {
    772787            psError(PS_ERR_UNKNOWN, false, "Stamp %d (%d,%d) is within the region border.\n", i, x, y);
    773788            return false;
    774789        }
    775         // fprintf (stderr, "stamp: %5.1f %5.1f == %d %d\n", stamp->x, stamp->y, x, y);
    776790
    777791        // Catch memory leaks --- these should have been freed and NULLed before
Note: See TracChangeset for help on using the changeset viewer.