Changeset 1901
- Timestamp:
- Sep 25, 2004, 11:03:05 AM (22 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 2 edited
-
pmSubtractBias.c (modified) (14 diffs)
-
pmSubtractBias.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmSubtractBias.c
r1889 r1901 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-09-2 4 23:47:21$10 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-09-25 21:03:05 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #endif 19 19 20 #include<stdio.h>21 #include<math.h>22 #include "pslib.h"23 20 #include "pmSubtractBias.h" 24 21 … … 57 54 (in->image)->data.F32[i][j]-= 58 55 (bias->image)->data.F32[i+in->row0-bias->row0][j+in->col0-bias->col0]; 56 59 57 ((in->mask)->data.U8[i][j])|= 60 58 (bias->mask)->data.U8[i+in->row0-bias->row0][j+in->col0-bias->col0]; … … 146 144 /****************************************************************************** 147 145 ScaleOverscanVector(): this routine takes as input an arbitrary vector, 148 creates a new vector of length n, and fills the new vector with the146 creates a new vector of length n, and fills the new vector with the 149 147 interpolated values of the old vector. The type of interpolation is: 150 148 PM_FIT_POLYNOMIAL: fit a polynomial to the entire input vector data. … … 159 157 pmFit fit) 160 158 { 159 if (n == overscanVector) { 160 return(overscanVector); 161 } 162 161 163 psVector *newVec = psVectorAlloc(n, PS_TYPE_F32); 162 164 psPolynomial1D *myPoly; … … 166 168 167 169 if (fit == PM_FIT_POLYNOMIAL) { 170 // Fit a polynomial to the old overscan vector. 168 171 myPoly = (psPolynomial1D *) fitSpec; 169 172 myPoly = psVectorFitPolynomial1D(myPoly, NULL, overscanVector, NULL); 173 174 // For each element of the new vector, convert the x-ordinate to that 175 // of the old vector, use the fitted polynomial to determine the 176 // interpolated value at that point, and set the new vector. 170 177 for (i=0;i<n;i++) { 171 x = (( (float) i) / ((float) n)) * ((float) overscanVector->n);178 x = ((float) i) * ((float) overscanVector->n) / ((float) n); 172 179 newVec->data.F32[i] = psPolynomial1DEval(x, myPoly); 173 180 } 174 181 } else if (fit == PM_FIT_SPLINE) { 182 // Fit a spline to the old overscan vector. 175 183 mySpline = (psSpline1D *) fitSpec; 176 184 mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL); 185 186 // For each element of the new vector, convert the x-ordinate to that 187 // of the old vector, use the fitted polynomial to determine the 188 // interpolated value at that point, and set the new vector. 177 189 for (i=0;i<n;i++) { 178 x = (( (float) i) / ((float) n)) * ((float) overscanVector->n);190 x = ((float) i) * ((float) overscanVector->n) / ((float) n); 179 191 newVec->data.F32[i] = psSpline1DEval(mySpline, x); 180 192 } … … 254 266 255 267 // XXX: How to use multiple overscans? Currently, only the first is used. 268 256 269 if ((overScanAxis == PM_OVERSCAN_ROWS) || (overScanAxis == PM_OVERSCAN_COLUMNS)) { 257 270 myOverscanImage = (psImage *) ((overscans->head)->data); … … 271 284 tmpRow->data.F32[j] = myOverscanImage->data.F32[i][j]; 272 285 } 273 stat = psVectorStats(stat, tmpRow, NULL, 0 xffffffff);286 stat = psVectorStats(stat, tmpRow, NULL, 0); 274 287 p_psGetStatValue(stat, &statValue); 275 288 overscanVector->data.F32[i] = statValue; … … 295 308 tmpRow->data.F32[j] = myOverscanImage->data.F32[i][j]; 296 309 } 297 stat = psVectorStats(stat, tmpRow, NULL, 0 xffffffff);310 stat = psVectorStats(stat, tmpRow, NULL, 0); 298 311 p_psGetStatValue(stat, &statValue); 299 312 overscanVector->data.F32[i] = statValue; 300 313 } 301 // tmpOverscan = tmpOverscan->next;314 // tmpOverscan = tmpOverscan->next; 302 315 tmpOverscan = NULL; 303 316 } … … 306 319 } 307 320 321 // 322 // Re-bin the overscan vector (change its length). 323 // 308 324 if ((nBin > 0) && (nBin < overscanVector->n)) { 309 325 numBins = 1+((overscanVector->n)/nBin); … … 327 343 328 344 } 345 329 346 // Change the effective size of overscanVector. 330 347 overscanVector->n = numBins; … … 338 355 } 339 356 357 // 358 // Fit a polynomial to the overscan vector. 359 // 340 360 if (!((fitSpec == NULL) || (fit == PM_FIT_NONE))) { 341 361 if (fit == PM_FIT_POLYNOMIAL) { … … 352 372 } 353 373 374 // 375 // Subtract overscan vector row-wise from the image. 376 // 354 377 if (overScanAxis == PM_OVERSCAN_ROWS) { 355 378 for (i=0;i<(in->image)->numCols;i++) { … … 360 383 } 361 384 385 // 386 // Subtract overscan vector column-wise from the image. 387 // 362 388 if (overScanAxis == PM_OVERSCAN_COLUMNS) { 363 389 for (i=0;i<(in->image)->numRows;i++) { -
trunk/psModules/src/pmSubtractBias.h
r1883 r1901 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-09-2 4 22:33:17$10 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-09-25 21:03:05 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include<math.h> 26 26 #include "pslib.h" 27 // XXX: have Desonia do this correctly. 28 #include "../../psLib/src/dataManip/psConstants.h" 27 29 28 30 typedef enum {
Note:
See TracChangeset
for help on using the changeset viewer.
