IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 19, 2008, 6:06:31 PM (18 years ago)
Author:
Paul Price
Message:

Changing how interpolation works with masked pixels. Previously, the pixel was defined as off the image if any part of the interpolation kernel was off the image; also, the interpolation kernel was applied to the image *without masking*, and the result of interpolation was flagged as bad/poor depending on the fractional contribution of the masked pixels. These very conservative approaches can result in significantly inflating bad pixel regions. Now, the interpolation kernel is applied, masking bad pixels, and pixels are flagged as bad/poor depending on the fractional contribution of the square of the kernel (i.e., according to its effect on the variance --- does the lack of data blow up the variance?). This also allows us to do a bit better at the edges of the image --- we no longer give up as soon as the interpolation kernel is touching the edge, but we measure the effect and return bad/poor accordingly. This made the test (tap_psImageInterpolate2.c) a bit trickier since one doesn't know whether a pixel should be bad or poor without doing the calculation, which is exactly what we're testing. Decided not to check the value, just the returned result (bad/poor) for these cases. Test passes; whether the results at the edge are correct or not, I don't know, but at least they should be masked appropriately.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/imageops/tap_psImageInterpolate2.c

    r12812 r19129  
    8686
    8787    for (int i = 0; i < num; i++) {
    88         float x = psRandomUniform(rng) * xSize;
    89         float y = psRandomUniform(rng) * ySize;
     88        float x = psRandomUniform(rng) * (xSize - 1);
     89        float y = psRandomUniform(rng) * (ySize - 1);
    9090
    9191        // Values from interpolation
     
    9393        psMaskType maskVal;
    9494
    95         bool success = psImageInterpolate(&imageVal, &varianceVal, &maskVal, x, y, interp);
    96         ok(success, "Interpolation at %.2f,%.2f", x, y);
    97         skip_start(!success, 1, "Interpolation failed");
     95        psImageInterpolateStatus status = psImageInterpolate(&imageVal, &varianceVal, &maskVal, x, y, interp);
     96        ok(status != PS_INTERPOLATE_STATUS_ERROR, "Interpolation at %.2f,%.2f (%x)", x, y, status);
     97        skip_start(status == PS_INTERPOLATE_STATUS_ERROR, 1, "Interpolation failed");
    9898
    9999        int xCentral, yCentral;         // Central pixel of interpolation
     
    112112        if (xCentral - (xKernel - 1) / 2 < 0 || xCentral + xKernel / 2 > xSize - 1 ||
    113113            yCentral - (yKernel - 1) / 2 < 0 || yCentral + yKernel / 2 > ySize - 1) {
    114             ok(isnan(imageVal), "Interpolation = %f vs NAN (border)", imageVal);
     114            ok(status == PS_INTERPOLATE_STATUS_BAD || status == PS_INTERPOLATE_STATUS_POOR,
     115               "Interpolation at border");
    115116        } else {
    116117            is_double_tol(imageVal, imageFunc(x, y), tol, "Interpolation = %f vs %f",
Note: See TracChangeset for help on using the changeset viewer.