IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 2, 2007, 4:28:24 PM (19 years ago)
Author:
Paul Price
Message:

Adding function pmSubtractionOrder (choice of name is probably not the best) to determine which of the two images under consideration should be convolved to match the other. Originally was doing this by solving for a RING kernel of width 1, going both ways, and comparing the deviations for each. However, when doing stacks this didn't work (convolving the wider fake Gaussian image gave smaller deviations than convolving the narrower input image), so have settled on measuring the second moments for each stamp, and using the ratio of moments between the two images to determine which is wider; this seems to work for both subtracting and stacking images. In the process, plugged a few memory leaks, and added code to support convolving either way (or both ways; this will be useful when it comes time to code the dual convolution algorithm).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmStackReject.c

    r14701 r15443  
    5252
    5353    // Convolve the image with the kernel --- we're basically applying a matched filter and then thresholding
    54     psImage *convolved = NULL;          // Convolved image
     54    pmReadout *convRO = pmReadoutAlloc(NULL); // Readout with convolved image
     55    pmReadout *inRO = pmReadoutAlloc(NULL); // Readout with input image
     56    inRO->image = image;
    5557    for (int i = 0; i < numRegions; i++) {
    5658        psRegion *region = regions->data[i]; // Region of interest
    5759        psVector *solution = solutions->data[i]; // Solution of interest
    58         if (!pmSubtractionConvolve(&convolved, NULL, NULL, image, NULL, NULL, 0,
    59                                    region, solution, kernels, true)) {
     60        if (!pmSubtractionConvolve(convRO, inRO, NULL, NULL, 0, region, solution, kernels, true,
     61                                   PM_SUBTRACTION_MODE_1)) {
    6062            psError(PS_ERR_UNKNOWN, false, "Unable to convolve mask image in region %d.", i);
    61             psFree(convolved);
    62             psFree(image);
     63            psFree(convRO);
     64            psFree(inRO);
    6365            return NULL;
    6466        }
     
    7375        if (!kernel) {
    7476            psError(PS_ERR_UNKNOWN, false, "Unable to generate kernel image.");
    75             psFree(convolved);
    76             psFree(image);
     77            psFree(convRO);
     78            psFree(inRO);
    7779            return NULL;
    7880        }
     
    8587        psFree(kernel);
    8688
    87         psImage *subConv = psImageSubset(convolved, *region); // Sub-image of convolved image
     89        psImage *subConv = psImageSubset(convRO->image, *region); // Sub-image of convolved image
    8890        psBinaryOp(subConv, subConv, "*", psScalarAlloc(1.0 / sum, PS_TYPE_F32));
    8991    }
    90     psFree(image);
     92    psFree(inRO);
     93    psImage *convolved = psMemIncrRefCounter(convRO->image);
     94    psFree(convRO);
    9195
    9296    // Threshold the convolved image
Note: See TracChangeset for help on using the changeset viewer.