IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 11:37:30 AM (16 years ago)
Author:
Paul Price
Message:

Fix confusion between columns in the image and columns in the correction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psModules/src/detrend/pmPattern.c

    r26844 r26845  
    158158    int numCols = image->numCols, numRows = image->numRows; // Size of image
    159159
    160     psPolynomial1D *poly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, numCols - 1); // Polynomial to apply
     160    if (corr->numRows != numRows) {
     161        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     162                "Number of rows of image (%d) does not match number of rows of pattern correction (%d)\n",
     163                numRows, corr->numRows);
     164        return false;
     165    }
     166
     167    int order = corr->numCols - 1;                                        // Polynomial order
     168    psPolynomial1D *poly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, order); // Polynomial to apply
    161169    psVector *indices = psVectorAlloc(numCols, PS_TYPE_F32); // Indices for polynomial
    162170    float norm = 2.0 / (float)numCols;  // Normalisation for indices
     
    166174
    167175    for (int y = 0; y < numRows; y++) {
    168         memcpy(poly->coeff, corr->data.F64[y], numCols * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
     176        memcpy(poly->coeff, corr->data.F64[y], order * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    169177        psVector *solution = psPolynomial1DEvalVector(poly, indices); // Solution vector
    170178        if (!solution) {
Note: See TracChangeset for help on using the changeset viewer.