IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 30, 2004, 10:32:21 AM (22 years ago)
Author:
evanalst
Message:

Add addition test case for invalid interpolation mode and bilinear mode for
psImageShift. Updated verified file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImageManip.c

    r1931 r1934  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-09-30 18:47:23 $
     8 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-09-30 20:32:21 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    16111611    }
    16121612
     1613    // Verify the returned psImage structure is null and program execution
     1614    // doesn't stop, if the specified interpolation mode is invalid.
     1615    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error for invalid interpolation mode.");
     1616    fOut = psImageShift(fOut,fImg,8,8,NAN,-1);
     1617    if (fOut != NULL ) {
     1618        psError(__func__,"psImageShift didn't return NULL given an invalid interpolation mode.");
     1619        return 12;
     1620    }
     1621
    16131622    psFree(fImg);
    16141623
     
    16291638    psImage* fImg = psImageAlloc(cols,rows,PS_TYPE_F32);
    16301639    psImage* sImg = psImageAlloc(cols,rows,PS_TYPE_S16);
     1640    psImage* fBiOut = psImageAlloc(cols,rows,PS_TYPE_F32);
     1641    psImage* sBiOut = psImageAlloc(cols,rows,PS_TYPE_S16);
    16311642
    16321643    for(int row=0;row<rows;row++) {
     
    16411652    fOut = psImageShift(fOut, fImg, colShift, rowShift, NAN, PS_INTERPOLATE_FLAT);
    16421653    sOut = psImageShift(sOut, sImg, colShift, rowShift, -1, PS_INTERPOLATE_FLAT);
     1654    fBiOut = psImageShift(fBiOut, fImg, colShift, rowShift, NAN, PS_INTERPOLATE_BILINEAR);
     1655    sBiOut = psImageShift(sBiOut, sImg, colShift, rowShift, -1, PS_INTERPOLATE_BILINEAR);
    16431656
    16441657    for(int row=0;row<rows;row++) {
    16451658        psF32* fRow = fOut->data.F32[row];
    16461659        psS16* sRow = sOut->data.S16[row];
     1660        psF32* fBiRow = fBiOut->data.F32[row];
     1661        psS16* sBiRow = sBiOut->data.S16[row];
     1662
    16471663        for (int col=0;col<cols;col++) {
    16481664            psF32 fValue = psImagePixelInterpolate(fImg,col+colShift,
     
    16501666            psS16 sValue = (psS16)psImagePixelInterpolate(sImg,col+colShift,
    16511667                           row+rowShift,NULL,0,-1,PS_INTERPOLATE_FLAT);
     1668
     1669            psF32 fBiValue = psImagePixelInterpolate(fImg,col+colShift,
     1670                             row+rowShift,NULL,0,NAN,PS_INTERPOLATE_BILINEAR);
     1671            psS16 sBiValue = (psS16)psImagePixelInterpolate(sImg,col+colShift,
     1672                             row+rowShift,NULL,0,-1,PS_INTERPOLATE_BILINEAR);
    16521673
    16531674            if (fabsf(fRow[col] - fValue) > FLT_EPSILON) {
     
    16611682                return 2;
    16621683            }
     1684            if (fabsf(fBiRow[col] - fBiValue) > FLT_EPSILON) {
     1685                psError(__func__,"Float image not shifted correctly at %d,%d (%g vs %g)",
     1686                        col,row,fBiRow[col],fBiValue);
     1687                return 1;
     1688            }
     1689            if (sBiRow[col] != sBiValue) {
     1690                psError(__func__,"Short image not shifted correctly at %d,%d (%d vs %d)",
     1691                        col,row,sBiRow[col],sBiValue);
     1692                return 2;
     1693            }
    16631694        }
    16641695    }
     
    16681699    psFree(fOut);
    16691700    psFree(sOut);
     1701    psFree(fBiOut);
     1702    psFree(sBiOut);
    16701703
    16711704    return 0;
Note: See TracChangeset for help on using the changeset viewer.