IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24272


Ignore:
Timestamp:
May 28, 2009, 12:05:39 PM (17 years ago)
Author:
Paul Price
Message:

Copy covariance matrix when copying readout.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageConvolve.c

    r21337 r24272  
    122122
    123123    return kernel;
     124}
     125
     126psKernel *psKernelCopy(const psKernel *in)
     127{
     128    PS_ASSERT_KERNEL_NON_NULL(in, NULL);
     129
     130    psKernel *out = psAlloc(sizeof(psKernel)); // The copied kernel, to be returned
     131    psMemSetDeallocator(out,(psFreeFunc)kernelFree);
     132
     133    out->image = psImageCopy(NULL, in->image, PS_TYPE_KERNEL);
     134    out->xMin = in->xMin;
     135    out->xMax = in->xMax;
     136    out->yMin = in->yMin;
     137    out->yMax = in->yMax;
     138
     139    kernelRedirects(out, out->image->numRows);
     140
     141    return out;
    124142}
    125143
  • trunk/psLib/src/imageops/psImageConvolve.h

    r21335 r24272  
    9696    );
    9797
     98/// Copy a kernel
     99///
     100/// Performs a deep copy of the input kernel
     101psKernel *psKernelCopy(
     102    const psKernel *in                  ///< Kernel to be copied
     103    );
     104
    98105/// Checks the type of a particular pointer.
    99106///
  • trunk/psModules/src/camera/pmFPACopy.c

    r23761 r24272  
    242242        readoutCopyComponent(&targetReadout->variance, sourceReadout->variance, binning, xFlip, yFlip,
    243243                             pixels);
     244        // Copy covariance matrix: doesn't care about flips, etc.
     245        if (sourceReadout->covariance) {
     246            if (targetReadout->covariance) {
     247                psFree(targetReadout->covariance);
     248            }
     249            targetReadout->covariance = psKernelCopy(sourceReadout->covariance);
     250#if 0
     251            if (binning) {
     252                // XXX This isn't strictly correct, but we don't have a function that bins covariance matrices
     253                // with unequal binning factors.
     254                psKernel *covar = psImageCovarianceBin(PS_MAX(binning->nXbin, binning->nYbin),
     255                                                       targetReadout->covariance);
     256                psFree(targetReadout->covariance);
     257                targetReadout->covariance = covar;
     258            }
     259#endif
     260        }
    244261
    245262        // Copy bias
Note: See TracChangeset for help on using the changeset viewer.