Changeset 2105 for trunk/psLib/test/image
- Timestamp:
- Oct 13, 2004, 3:22:59 PM (22 years ago)
- Location:
- trunk/psLib/test/image
- Files:
-
- 3 edited
-
tst_psImageManip.c (modified) (4 diffs)
-
verified/tst_psImageExtraction.stderr (modified) (2 diffs)
-
verified/tst_psImageManip.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageManip.c
r1943 r2105 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10- 02 02:23:05$8 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-14 01:22:59 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 static int testImageShift(void); 35 35 static int testImageShiftCase(int cols, int rows, float colShift,float rowShift); 36 static int testImageResample(void); 36 37 37 38 testDescription tests[] = { … … 44 45 {testImageRotate,560,"psImageRotate",0,false}, 45 46 {testImageShift,561,"psImageShift",0,false}, 47 {testImageResample,743,"psImageResample",0,false}, 46 48 {NULL} 47 49 }; … … 1704 1706 return 0; 1705 1707 } 1708 1709 static int testImageResample(void) 1710 { 1711 1712 int rows = 60; 1713 int cols = 80; 1714 psImage* result = NULL; 1715 int scale = 4; 1716 psErr* err; 1717 1718 psImage* image = psImageAlloc(cols,rows,PS_TYPE_F32); 1719 for(int row=0;row<rows;row++) { 1720 psF32* imageRow = image->data.F32[row]; 1721 for (int col=0;col<cols;col++) { 1722 imageRow[col] = row+2*col; 1723 } 1724 } 1725 result = psImageCopy(NULL,image,PS_TYPE_F64); 1726 psImage* orig = result; 1727 result = psImageResample(result,image,scale,PS_INTERPOLATE_FLAT); 1728 1729 if (result == NULL) { 1730 psLogMsg(__func__,PS_LOG_ERROR, 1731 "NULL return unexpected"); 1732 return 1; 1733 } 1734 1735 if (result != orig) { 1736 psLogMsg(__func__,PS_LOG_ERROR,"failure to recycle image."); 1737 return 2; 1738 } 1739 1740 if (result->type.type != PS_TYPE_F32) { 1741 psLogMsg(__func__,PS_LOG_ERROR,"unexpected type"); 1742 return 3; 1743 } 1744 1745 1746 if (result->numCols != image->numCols*scale || 1747 result->numRows != image->numRows*scale) { 1748 psLogMsg(__func__,PS_LOG_ERROR,"The size of the result is %dx%d, but %dx%d was expected.", 1749 result->numCols,result->numRows, 1750 image->numCols*scale, image->numRows*scale); 1751 return 4; 1752 } 1753 1754 psF32 truthValue; 1755 for(int row=0;row<result->numRows;row++) { 1756 for (int col=0;col<result->numCols;col++) { 1757 truthValue = psImagePixelInterpolate(image, 1758 (float)col/(float)scale,(float)row/(float)scale, 1759 NULL,0,-1,PS_INTERPOLATE_FLAT); 1760 if (fabs(truthValue - result->data.F32[row][col]) > FLT_EPSILON) { 1761 psLogMsg(__func__,PS_LOG_ERROR,"value bad at (%d,%d). Got %g, expected %g.", 1762 col,row,result->data.F32[row][col], truthValue); 1763 return 5; 1764 } 1765 } 1766 } 1767 1768 // verify that image=null is handled properly. 1769 psErrorClear(); 1770 result = psImageResample(result,NULL,scale,PS_INTERPOLATE_FLAT); 1771 1772 if (result != NULL) { 1773 psLogMsg(__func__,PS_LOG_ERROR, 1774 "return was not NULL, as expected."); 1775 return 6; 1776 } 1777 err = psErrorLast(); 1778 if (err->code != PS_ERR_BAD_PARAMETER_NULL) { 1779 psLogMsg(__func__,PS_LOG_ERROR, 1780 "error message was not appropriate type."); 1781 return 7; 1782 } 1783 psFree(err); 1784 1785 // verify that scale < 1 is handled properly 1786 psErrorClear(); 1787 result = psImageResample(result,image,0,PS_INTERPOLATE_FLAT); 1788 1789 if (result != NULL) { 1790 psLogMsg(__func__,PS_LOG_ERROR, 1791 "return was not NULL, as expected."); 1792 return 8; 1793 } 1794 err = psErrorLast(); 1795 if (err->code != PS_ERR_BAD_PARAMETER_VALUE) { 1796 psLogMsg(__func__,PS_LOG_ERROR, 1797 "error message was not appropriate type."); 1798 return 9; 1799 } 1800 psFree(err); 1801 1802 // verify that invalid interpolation mode is handled properly 1803 psErrorClear(); 1804 result = psImageResample(result,image,2,0); 1805 1806 if (result != NULL) { 1807 psLogMsg(__func__,PS_LOG_ERROR, 1808 "return was not NULL, as expected."); 1809 return 10; 1810 } 1811 err = psErrorLast(); 1812 if (err->code != PS_ERR_BAD_PARAMETER_VALUE) { 1813 psLogMsg(__func__,PS_LOG_ERROR, 1814 "error message was not appropriate type."); 1815 return 11; 1816 } 1817 psFree(err); 1818 1819 psFree(image); 1820 psFree(result); 1821 1822 return 0; 1823 } 1824 -
trunk/psLib/test/image/verified/tst_psImageExtraction.stderr
r2095 r2105 138 138 Following should be an error. 139 139 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 140 Input psImage mask size, 2000x1000, does not match psImage input size, 1 869636978x1635018016.141 <DATE><TIME>|<HOST>|I|testImageSlice 142 Following should be an error. 143 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 144 Input psImage mask size, 2000x1000, does not match psImage input size, 1 869636978x1635018016.140 Input psImage mask size, 2000x1000, does not match psImage input size, 1919250543x543519841. 141 <DATE><TIME>|<HOST>|I|testImageSlice 142 Following should be an error. 143 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 144 Input psImage mask size, 2000x1000, does not match psImage input size, 1919250543x543519841. 145 145 <DATE><TIME>|<HOST>|I|testImageSlice 146 146 Following should be an error. … … 150 150 Following should be an error. 151 151 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 152 Input psImage mask size, 2000x1000, does not match psImage input size, 1 869636978x1635018016.153 <DATE><TIME>|<HOST>|I|testImageSlice 154 Following should be an error. 155 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 156 Input psImage mask size, 2000x1000, does not match psImage input size, 1 869636978x1635018016.157 <DATE><TIME>|<HOST>|I|testImageSlice 158 Following should be an error. 159 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 160 Input psImage mask size, 2000x1000, does not match psImage input size, 1 869636978x1635018016.161 <DATE><TIME>|<HOST>|I|testImageSlice 162 Following should be an error. 163 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 164 Input psImage mask size, 2000x1000, does not match psImage input size, 1 869636978x1635018016.165 <DATE><TIME>|<HOST>|I|testImageSlice 166 Following should be an error. 167 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 168 Input psImage mask size, 2000x1000, does not match psImage input size, 1 869636978x1635018016.152 Input psImage mask size, 2000x1000, does not match psImage input size, 1919250543x543519841. 153 <DATE><TIME>|<HOST>|I|testImageSlice 154 Following should be an error. 155 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 156 Input psImage mask size, 2000x1000, does not match psImage input size, 1919250543x543519841. 157 <DATE><TIME>|<HOST>|I|testImageSlice 158 Following should be an error. 159 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 160 Input psImage mask size, 2000x1000, does not match psImage input size, 1919250543x543519841. 161 <DATE><TIME>|<HOST>|I|testImageSlice 162 Following should be an error. 163 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 164 Input psImage mask size, 2000x1000, does not match psImage input size, 1919250543x543519841. 165 <DATE><TIME>|<HOST>|I|testImageSlice 166 Following should be an error. 167 <DATE><TIME>|<HOST>|E|psLib.image.psImageSlice 168 Input psImage mask size, 2000x1000, does not match psImage input size, 1919250543x543519841. 169 169 <DATE><TIME>|<HOST>|I|testImageSlice 170 170 Following should be an error mask size != image size. -
trunk/psLib/test/image/verified/tst_psImageManip.stderr
r1943 r2105 307 307 ---> TESTPOINT PASSED (psImage{psImageShift} | tst_psImageManip.c) 308 308 309 /***************************** TESTPOINT ******************************************\ 310 * TestFile: tst_psImageManip.c * 311 * TestPoint: psImage{psImageResample} * 312 * TestType: Positive * 313 \**********************************************************************************/ 314 315 <DATE><TIME>|<HOST>|E|psLib.image.psImageResample 316 Can not operate on a NULL psImage. 317 <DATE><TIME>|<HOST>|E|psLib.image.psImageResample 318 Specified scale value, 0, must be a positive value. 319 <DATE><TIME>|<HOST>|E|psLib.image.psImageResample 320 Specified interpolation mode, 0, is unsupported. 321 322 ---> TESTPOINT PASSED (psImage{psImageResample} | tst_psImageManip.c) 323
Note:
See TracChangeset
for help on using the changeset viewer.
