IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 1, 2007, 4:03:58 PM (19 years ago)
Author:
magnier
Message:

updates to the image map tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20070830/psLib/src/imageops/psImagePixelInterpolate.c

    r14721 r14723  
    1111 *  @author Eugene Magnier, IfA
    1212 *
    13  *  @version $Revision: 1.1.2.1 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2007-09-01 00:41:01 $
     13 *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2007-09-02 02:03:58 $
    1515 *
    1616 *  Copyright 2007 Institute for Astronomy, University of Hawaii
     
    3232#include "psAssert.h"
    3333#include "psString.h"
     34#include "psPolynomial.h"
     35#include "psPolynomialUtils.h"
    3436#include "psImage.h"
    3537#include "psImageInterpolate.h"
     38#include "psImagePixelInterpolate.h"
    3639
    3740# define PS_IMAGE_ITER_STATE(XS,XE,YS,YE,N_MIN,TYPE) \
    3841            nGood = 0; \
    39             for (jy = YS; jy <= YE; jy++) { \
    40                 // stick to pixels in image grid \
     42            for (int jy = YS; jy <= YE; jy++) { \
     43                /* stick to pixels in image grid */ \
    4144                if (jy + iy < 0) { continue; } \
    4245                if (jy + iy >= mask->numRows) { continue; } \
    43                 for (jx = XS; jx <= XE; jx++) { \
    44                     // stick to pixels in image grid \
     46                for (int jx = XS; jx <= XE; jx++) { \
     47                    /* stick to pixels in image grid */ \
    4548                    if (jx + ix < 0) { continue; } \
    4649                    if (jx + ix >= mask->numCols) { continue; } \
    47                     // do not test self \
     50                    /* do not test self */ \
    4851                    if (!jx && jy) { continue; } \
    4952                    if (mask->data.PS_TYPE_MASK_DATA[iy][ix] & maskVal) { continue; } \
     
    6669    psImageInit (result, 0);
    6770   
    68     int nPoor = 0;
    69     int nBad = 0;
     71    *nPoor = 0;
     72    *nBad = 0;
    7073
    7174    for (int iy = 0; iy < mask->numRows; iy++) {
     
    103106              case PS_IMAGE_INTERPOLATE_GOOD:
    104107                // skip the good pixels
    105                 continue;
     108                break;
    106109
    107110              case PS_IMAGE_INTERPOLATE_BAD:
    108111                // skip the bad pixels
    109                 continue;
     112                break;
    110113
    111               case PS_IMAGE_INTERPOLATE_CENTER:
    112                 // fit a quadratic to the valid neighbor pixels
    113                 // apply the quadratic to get the poor pixel value
    114                 psPolynomial2D *poly = psImageBicubeFit (image, mask, maskVal, ix, iy);
    115                 image->data.F32[iy][ix] = poly->coeff[0][0];
    116                 continue;
     114              case PS_IMAGE_INTERPOLATE_CENTER: {
     115                  // fit a quadratic to the valid neighbor pixels
     116                  // apply the quadratic to get the poor pixel value
     117                  psPolynomial2D *poly = psImageBicubeFit (image, mask, maskVal, ix, iy);
     118                  image->data.F32[iy][ix] = poly->coeff[0][0];
     119                  break; }
    117120
    118               case PS_IMAGE_INTERPOLATE_LL:
    119                 // fit a plane to the valid neighbor pixels
    120                 // apply the plane to get the poor pixel value
    121                 psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 1, iy - 1);
    122                 image->data.F32[iy][ix] = poly->coeff[0][0] + poly->coeff[1][0] + poly->coeff[0][1];
    123                 continue;
    124               case PS_IMAGE_INTERPOLATE_LR:
    125                 // fit a plane to the valid neighbor pixels
    126                 // apply the plane to get the poor pixel value
    127                 psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 0, iy - 1);
    128                 image->data.F32[iy][ix] = poly->coeff[0][0] + poly->coeff[0][1];
    129                 continue;
    130               case PS_IMAGE_INTERPOLATE_UL:
    131                 // fit a plane to the valid neighbor pixels
    132                 // apply the plane to get the poor pixel value
    133                 psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 1, iy - 0);
    134                 image->data.F32[iy][ix] = poly->coeff[0][0] + poly->coeff[1][0];
    135                 continue;
    136               case PS_IMAGE_INTERPOLATE_UR:
    137                 // fit a plane to the valid neighbor pixels
    138                 // apply the plane to get the poor pixel value
    139                 psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 0, iy - 0);
    140                 image->data.F32[iy][ix] = poly->coeff[0][0];
    141                 continue;
     121              case PS_IMAGE_INTERPOLATE_LL: {
     122                  // fit a plane to the valid neighbor pixels
     123                  // apply the plane to get the poor pixel value
     124                  psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 1, iy - 1);
     125                  image->data.F32[iy][ix] = poly->coeff[0][0] + poly->coeff[1][0] + poly->coeff[0][1];
     126                  break; }
     127
     128              case PS_IMAGE_INTERPOLATE_LR: {
     129                  // fit a plane to the valid neighbor pixels
     130                  // apply the plane to get the poor pixel value
     131                  psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 0, iy - 1);
     132                  image->data.F32[iy][ix] = poly->coeff[0][0] + poly->coeff[0][1];
     133                  break; }
     134
     135              case PS_IMAGE_INTERPOLATE_UL: {
     136                  // fit a plane to the valid neighbor pixels
     137                  // apply the plane to get the poor pixel value
     138                  psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 1, iy - 0);
     139                  image->data.F32[iy][ix] = poly->coeff[0][0] + poly->coeff[1][0];
     140                  break; }
     141
     142              case PS_IMAGE_INTERPOLATE_UR: {
     143                  // fit a plane to the valid neighbor pixels
     144                  // apply the plane to get the poor pixel value
     145                  psPolynomial2D *poly = psImageBilinearFit (image, mask, maskVal, ix - 0, iy - 0);
     146                  image->data.F32[iy][ix] = poly->coeff[0][0];
     147                  break; }
     148
     149              default:
     150                psAbort("impossible case in __func__");
    142151            }
    143152        }           
    144153    }
    145     return result;
     154    return true;
    146155}
    147156
     157   
Note: See TracChangeset for help on using the changeset viewer.