IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 24, 2004, 1:47:21 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmSubtractBias.c

    r1885 r1889  
    88 *  @author George Gusciora, MHPCC
    99 *
    10  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-09-24 23:00:37 $
     10 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-09-24 23:47:21 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    144144}
    145145
    146 // XXX: Must scale the overscan vector
     146/******************************************************************************
     147ScaleOverscanVector(): this routine takes as input an arbitrary vector,
     148creates anew vector of length n, and fills the new vector with the
     149interpolated values of the old vector.  The type of interpolation is:
     150    PM_FIT_POLYNOMIAL: fit a polynomial to the entire input vector data.
     151    PM_FIT_SPLINE: fit splines to the input vector data.
     152XXX: Doesn't it make more sense to do polynomial interpolation on a few
     153elements of the input vector, rather than fit a polynomial to the entire
     154vector?
     155 *****************************************************************************/
    147156psVector *ScaleOverscanVector(psVector *overscanVector,
    148157                              int n,
     158                              void *fitSpec,
    149159                              pmFit fit)
    150160{
    151161    psVector *newVec = psVectorAlloc(n, PS_TYPE_F32);
    152 
    153     if (fit == PM_FIT_POLYNOMIAL) {}
    154     else if (fit == PM_FIT_SPLINE) {}
    155     else {}
     162    psPolynomial1D *myPoly;
     163    psSpline1D *mySpline;
     164    float x;
     165    int i;
     166
     167    if (fit == PM_FIT_POLYNOMIAL) {
     168        myPoly = (psPolynomial1D *) fitSpec;
     169        myPoly = psVectorFitPolynomial1D(myPoly, NULL, overscanVector, NULL);
     170        for (i=0;i<n;i++) {
     171            x = (((float) i) / ((float) n)) * ((float) overscanVector->n);
     172            newVec->data.F32[i] = psPolynomial1DEval(x, myPoly);
     173        }
     174    } else if (fit == PM_FIT_SPLINE) {
     175        mySpline = (psSpline1D *) fitSpec;
     176        mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
     177        for (i=0;i<n;i++) {
     178            x = (((float) i) / ((float) n)) * ((float) overscanVector->n);
     179            newVec->data.F32[i] = psSpline1DEval(mySpline, x);
     180        }
     181    } else {
     182        // XXX: psErrorMsg()
     183    }
     184
    156185    return(newVec);
    157186}
     
    251280            }
    252281            psFree(tmpRow);
    253             ScaleOverscanVector(overscanVector, (in->image)->numCols, fit);
     282            ScaleOverscanVector(overscanVector, (in->image)->numCols, fitSpec, fit);
    254283        }
    255284        if (overScanAxis == PM_OVERSCAN_COLUMNS) {
     
    274303            }
    275304            psFree(tmpCol);
    276             ScaleOverscanVector(overscanVector, (in->image)->numRows, fit);
     305            ScaleOverscanVector(overscanVector, (in->image)->numRows, fitSpec, fit);
    277306        }
    278307
Note: See TracChangeset for help on using the changeset viewer.