- Timestamp:
- Sep 1, 2007, 4:03:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070830/psLib/src/imageops/psImagePixelInterpolate.c
r14721 r14723 11 11 * @author Eugene Magnier, IfA 12 12 * 13 * @version $Revision: 1.1.2. 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2007-09-0 1 00:41:01$13 * @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-09-02 02:03:58 $ 15 15 * 16 16 * Copyright 2007 Institute for Astronomy, University of Hawaii … … 32 32 #include "psAssert.h" 33 33 #include "psString.h" 34 #include "psPolynomial.h" 35 #include "psPolynomialUtils.h" 34 36 #include "psImage.h" 35 37 #include "psImageInterpolate.h" 38 #include "psImagePixelInterpolate.h" 36 39 37 40 # define PS_IMAGE_ITER_STATE(XS,XE,YS,YE,N_MIN,TYPE) \ 38 41 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 */ \ 41 44 if (jy + iy < 0) { continue; } \ 42 45 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 */ \ 45 48 if (jx + ix < 0) { continue; } \ 46 49 if (jx + ix >= mask->numCols) { continue; } \ 47 / / do not test self\50 /* do not test self */ \ 48 51 if (!jx && jy) { continue; } \ 49 52 if (mask->data.PS_TYPE_MASK_DATA[iy][ix] & maskVal) { continue; } \ … … 66 69 psImageInit (result, 0); 67 70 68 intnPoor = 0;69 intnBad = 0;71 *nPoor = 0; 72 *nBad = 0; 70 73 71 74 for (int iy = 0; iy < mask->numRows; iy++) { … … 103 106 case PS_IMAGE_INTERPOLATE_GOOD: 104 107 // skip the good pixels 105 continue;108 break; 106 109 107 110 case PS_IMAGE_INTERPOLATE_BAD: 108 111 // skip the bad pixels 109 continue;112 break; 110 113 111 case PS_IMAGE_INTERPOLATE_CENTER: 112 // fit a quadratic to the valid neighbor pixels113 // apply the quadratic to get the poor pixel value114 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; } 117 120 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__"); 142 151 } 143 152 } 144 153 } 145 return result;154 return true; 146 155 } 147 156 157
Note:
See TracChangeset
for help on using the changeset viewer.
