IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 22, 2006, 2:48:04 PM (20 years ago)
Author:
Paul Price
Message:

Adding GPL stuff, for distribution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/src/poisStamp.c

    r5717 r8480  
     1// Copyright (C) 2006  Paul A. Price (price@ifa.hawaii.edu)
     2//
     3// This program is free software; you can redistribute it and/or modify
     4// it under the terms of the GNU General Public License as published by
     5// the Free Software Foundation; either version 2 of the License, or
     6// (at your option) any later version.
     7//
     8// This program is distributed in the hope that it will be useful,
     9// but WITHOUT ANY WARRANTY; without even the implied warranty of
     10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11// GNU General Public License for more details.
     12//
     13// You should have received a copy of the GNU General Public License
     14// along with this program; if not, write to the Free Software
     15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     16
    117#include <stdio.h>
    218#include "pslib.h"
     
    1935{
    2036    if (stamp->matrix) {
    21         psFree(stamp->matrix);
     37        psFree(stamp->matrix);
    2238    }
    2339    if (stamp->vector) {
    24         psFree(stamp->vector);
     40        psFree(stamp->vector);
    2541    }
    2642    psFree(stamp);
     
    3046// Return true if the stamp is OK
    3147bool poisCheckStamp(const psImage *image, // Image to check for threshold
    32                     const psImage *mask, // Mask to check for bad pixels
    33                     int x, int y,       // Pixel coordinates
    34                     const poisConfig *config // Configuration
     48                    const psImage *mask, // Mask to check for bad pixels
     49                    int x, int y,       // Pixel coordinates
     50                    const poisConfig *config // Configuration
    3551    )
    3652{
    3753    if (x < config->footprint + config->xKernel ||
    38         y < config->footprint + config->yKernel ||
    39         x > config->xImage - config->footprint - config->xKernel ||
    40         y > config->yImage - config->footprint - config->yKernel ||
    41         image->data.F32[y][x] < config->threshold) {
    42         psTrace("pois.checkStamp", 9, "Rejecting stamp at %d,%d (border/threshold)\n", x, y);
    43         return false;
     54        y < config->footprint + config->yKernel ||
     55        x > config->xImage - config->footprint - config->xKernel ||
     56        y > config->yImage - config->footprint - config->yKernel ||
     57        image->data.F32[y][x] < config->threshold) {
     58        psTrace("pois.checkStamp", 9, "Rejecting stamp at %d,%d (border/threshold)\n", x, y);
     59        return false;
    4460    }
    4561
    4662    // Check the footprint
    47     bool ok = true;                     // Is the footprint OK?
    48     int footprint = config->footprint;  // Footprint size
     63    bool ok = true;                     // Is the footprint OK?
     64    int footprint = config->footprint;  // Footprint size
    4965    for (int v = y - footprint; v <= y + footprint && ok; v++) {
    50         for (int u = x - footprint; u <= x + footprint && ok; u++) {
    51             if (mask->data.U8[v][u] &
    52                 (POIS_MASK_BAD | POIS_MASK_NEAR_BAD | POIS_MASK_STAMP)) {
    53                 psTrace("pois.checkStamp", 9, "Rejecting stamp at %d,%d (bad footprint)\n", x, y);
    54                 ok = false;
    55             }
    56         }
     66        for (int u = x - footprint; u <= x + footprint && ok; u++) {
     67            if (mask->data.U8[v][u] &
     68                (POIS_MASK_BAD | POIS_MASK_NEAR_BAD | POIS_MASK_STAMP)) {
     69                psTrace("pois.checkStamp", 9, "Rejecting stamp at %d,%d (bad footprint)\n", x, y);
     70                ok = false;
     71            }
     72        }
    5773    }
    58    
     74
    5975    return ok;
    6076}
Note: See TracChangeset for help on using the changeset viewer.