Changeset 8480 for trunk/pois/src/poisStamp.c
- Timestamp:
- Aug 22, 2006, 2:48:04 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/pois/src/poisStamp.c (modified) (3 diffs)
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 1 17 #include <stdio.h> 2 18 #include "pslib.h" … … 19 35 { 20 36 if (stamp->matrix) { 21 psFree(stamp->matrix);37 psFree(stamp->matrix); 22 38 } 23 39 if (stamp->vector) { 24 psFree(stamp->vector);40 psFree(stamp->vector); 25 41 } 26 42 psFree(stamp); … … 30 46 // Return true if the stamp is OK 31 47 bool poisCheckStamp(const psImage *image, // Image to check for threshold 32 const psImage *mask, // Mask to check for bad pixels33 int x, int y,// Pixel coordinates34 const poisConfig *config // Configuration48 const psImage *mask, // Mask to check for bad pixels 49 int x, int y, // Pixel coordinates 50 const poisConfig *config // Configuration 35 51 ) 36 52 { 37 53 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; 44 60 } 45 61 46 62 // Check the footprint 47 bool ok = true; // Is the footprint OK?48 int footprint = config->footprint; // Footprint size63 bool ok = true; // Is the footprint OK? 64 int footprint = config->footprint; // Footprint size 49 65 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 } 57 73 } 58 74 59 75 return ok; 60 76 }
Note:
See TracChangeset
for help on using the changeset viewer.
