IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2105 for trunk/psLib/src/image


Ignore:
Timestamp:
Oct 13, 2004, 3:22:59 PM (22 years ago)
Author:
desonia
Message:

added test for psImageResample.

Location:
trunk/psLib/src/image
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImage.c

    r2067 r2105  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-13 00:10:50 $
     12 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-14 01:22:59 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    441441        psF64 unexposedValue) \
    442442{ \
    443     int intX = (int) round((psF64)(x) - 0.5); \
    444     int intY = (int) round((psF64)(y) - 0.5); \
     443    int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \
     444    int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \
    445445    int lastX = input->numCols - 1; \
    446446    int lastY = input->numRows - 1; \
  • trunk/psLib/src/image/psImage.h

    r2067 r2105  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-13 00:10:50 $
     13 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-14 01:22:59 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131 */
    3232typedef enum {
    33     PS_INTERPOLATE_FLAT,               ///< 'flat' interpolation (nearest pixel)
     33    PS_INTERPOLATE_FLAT = 1,           ///< 'flat' interpolation (nearest pixel)
    3434    PS_INTERPOLATE_BILINEAR,           ///< bi-linear interpolation
    3535    PS_INTERPOLATE_BICUBIC,            ///< bi-cubic interpolation
    36     PS_INTERPOLATE_SINC                ///< sinc interpolation
     36    PS_INTERPOLATE_SINC,               ///< sinc interpolation
     37    PS_INTERPOLATE_NUM_MODES           ///< end-marker of list of modes; not a valid interpolation mode
    3738} psImageInterpolateMode;
    3839
  • trunk/psLib/src/image/psImageExtraction.c

    r2093 r2105  
    99 *  @author Robert DeSonia, MHPCC
    1010 *
    11  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-13 23:34:57 $
     11 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-14 01:22:59 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    543543    }
    544544
     545    if (mode < PS_INTERPOLATE_FLAT || mode >= PS_INTERPOLATE_NUM_MODES) {
     546        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
     547                   PS_ERR_BAD_PARAMETER_VALUE, true,
     548                   PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
     549                   mode);
     550        psFree(out);
     551        return NULL;
     552    }
     553
    545554    if (mask != NULL) {
    546555        if (numRows != mask->numRows || numCols != mask->numCols) {
  • trunk/psLib/src/image/psImageManip.c

    r1941 r2105  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-02 02:08:00 $
     12 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-14 01:22:59 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    569569        return NULL;
    570570    }
     571
     572    if (scale < 1) {
     573        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
     574                   PS_ERR_BAD_PARAMETER_VALUE, true,
     575                   PS_ERRORTEXT_psImageManip_SCALE_NOT_POSITIVE,
     576                   scale);
     577        psFree(out);
     578        return NULL;
     579    }
     580
     581    if (mode < PS_INTERPOLATE_FLAT || mode >= PS_INTERPOLATE_NUM_MODES) {
     582        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
     583                   PS_ERR_BAD_PARAMETER_VALUE, true,
     584                   PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
     585                   mode);
     586        psFree(out);
     587        return NULL;
     588    }
     589
    571590    // create an output image of the same size
    572591    // and type
     
    582601            float inRow = (float)row * invScale; \
    583602            for (int col=0;col<outCols;col++) { \
    584                 rowData[col] = psImagePixelInterpolate(in,inRow,(float)col*invScale,NULL,0,0,mode); \
     603                rowData[col] = psImagePixelInterpolate(in,(float)col*invScale,inRow,NULL,0,0,mode); \
    585604            } \
    586605        }  \
Note: See TracChangeset for help on using the changeset viewer.