Changeset 2860 for trunk/psLib/src/image
- Timestamp:
- Jan 3, 2005, 11:58:53 AM (22 years ago)
- Location:
- trunk/psLib/src/image
- Files:
-
- 2 edited
-
psImageManip.c (modified) (11 diffs)
-
psImageManip.h (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageManip.c
r2835 r2860 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $13 * @date $Date: 200 4-12-28 01:42:28$12 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-01-03 21:58:53 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include "psMemory.h" 26 26 #include "psImageExtraction.h" 27 27 #include "psConstants.h" 28 28 #include "psImageErrors.h" 29 29 … … 675 675 return NULL; 676 676 } 677 // put the angle in the range of 0... 360.678 angle = angle - 360.0f * floor(angle / 360.0f);679 680 if (fabsf(angle - 90.0f) < FLT_EPSILON) {677 // put the angle in the range of 0...2PI. 678 angle = angle - (2.0*PS_PI) * floor(angle / (2.0*PS_PI)); 679 680 if (fabsf(angle - PS_PI_2) < FLT_EPSILON) { 681 681 // perform 1/4 rotate counter-clockwise 682 682 psS32 numRows = in->numCols; … … 702 702 PSIMAGE_ROTATE_LEFT_90(U8); 703 703 PSIMAGE_ROTATE_LEFT_90(U16); 704 // PSIMAGE_ROTATE_LEFT_90(U32);Not a requirement705 // PSIMAGE_ROTATE_LEFT_90(U64);Not a requirement704 PSIMAGE_ROTATE_LEFT_90(U32); // Not a requirement 705 PSIMAGE_ROTATE_LEFT_90(U64); // Not a requirement 706 706 PSIMAGE_ROTATE_LEFT_90(S8); 707 707 PSIMAGE_ROTATE_LEFT_90(S16); 708 // PSIMAGE_ROTATE_LEFT_90(S32);Not a requirement709 // PSIMAGE_ROTATE_LEFT_90(S64);Not a requirement708 PSIMAGE_ROTATE_LEFT_90(S32); // Not a requirement 709 PSIMAGE_ROTATE_LEFT_90(S64); // Not a requirement 710 710 PSIMAGE_ROTATE_LEFT_90(F32); 711 711 PSIMAGE_ROTATE_LEFT_90(F64); … … 723 723 } 724 724 } 725 } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {725 } else if (fabsf(angle - PS_PI) < FLT_EPSILON) { 726 726 // perform 1/2 rotate 727 727 psS32 numRows = in->numRows; … … 748 748 PSIMAGE_ROTATE_180_CASE(U8); 749 749 PSIMAGE_ROTATE_180_CASE(U16); 750 // PSIMAGE_ROTATE_180_CASE(U32);Not a requirement751 // PSIMAGE_ROTATE_180_CASE(U64);Not a requirement750 PSIMAGE_ROTATE_180_CASE(U32); // Not a requirement 751 PSIMAGE_ROTATE_180_CASE(U64); // Not a requirement 752 752 PSIMAGE_ROTATE_180_CASE(S8); 753 753 PSIMAGE_ROTATE_180_CASE(S16); 754 // PSIMAGE_ROTATE_180_CASE(S32);Not a requirement755 // PSIMAGE_ROTATE_180_CASE(S64);Not a requirement754 PSIMAGE_ROTATE_180_CASE(S32); // Not a requirement 755 PSIMAGE_ROTATE_180_CASE(S64); // Not a requirement 756 756 PSIMAGE_ROTATE_180_CASE(F32); 757 757 PSIMAGE_ROTATE_180_CASE(F64); … … 769 769 } 770 770 } 771 } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {771 } else if (fabsf(angle - (PS_PI+PS_PI_2)) < FLT_EPSILON) { 772 772 // perform 1/4 rotate clockwise 773 773 psS32 numRows = in->numCols; … … 793 793 PSIMAGE_ROTATE_RIGHT_90(U8); 794 794 PSIMAGE_ROTATE_RIGHT_90(U16); 795 // PSIMAGE_ROTATE_RIGHT_90(U32);Not a requirement796 // PSIMAGE_ROTATE_RIGHT_90(U64);Not a requirement795 PSIMAGE_ROTATE_RIGHT_90(U32); // Not a requirement 796 PSIMAGE_ROTATE_RIGHT_90(U64); // Not a requirement 797 797 PSIMAGE_ROTATE_RIGHT_90(S8); 798 798 PSIMAGE_ROTATE_RIGHT_90(S16); 799 // PSIMAGE_ROTATE_RIGHT_90(S32);Not a requirement800 // PSIMAGE_ROTATE_RIGHT_90(S64);Not a requirement799 PSIMAGE_ROTATE_RIGHT_90(S32); // Not a requirement 800 PSIMAGE_ROTATE_RIGHT_90(S64); // Not a requirement 801 801 PSIMAGE_ROTATE_RIGHT_90(F32); 802 802 PSIMAGE_ROTATE_RIGHT_90(F64); … … 822 822 float centerX = (float)(numCols) / 2.0f; 823 823 float centerY = (float)(numRows) / 2.0f; 824 float t = angle * (3.14159265358f / 180.0f); 825 double cosT = cosf(t); 826 double sinT = sinf(t); 824 double cosT = cosf(angle); 825 double sinT = sinf(angle); 827 826 828 827 // calculate the corners of the rotated image so we know the proper output image size. … … 897 896 PSIMAGE_ROTATE_ARBITRARY_LOOP(U16,MODE); \ 898 897 break; \ 899 /* case PS_TYPE_U32:Not a requirement */ \900 /* PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); */\901 /* break; */\902 /* case PS_TYPE_U64:Not a requirement */ \903 /* PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); */\904 /* break; */\898 case PS_TYPE_U32: /* Not a requirement */ \ 899 PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); \ 900 break; \ 901 case PS_TYPE_U64: /* Not a requirement */ \ 902 PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); \ 903 break; \ 905 904 case PS_TYPE_S8: \ 906 905 PSIMAGE_ROTATE_ARBITRARY_LOOP(S8,MODE); \ … … 909 908 PSIMAGE_ROTATE_ARBITRARY_LOOP(S16,MODE); \ 910 909 break; \ 911 /* case PS_TYPE_S32:Not a requirement */ \912 /* PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); */\913 /* break; */\914 /* case PS_TYPE_S64:Not a requirement */ \915 /* PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); */\916 /* break; */\910 case PS_TYPE_S32: /* Not a requirement */ \ 911 PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); \ 912 break; \ 913 case PS_TYPE_S64: /* Not a requirement */ \ 914 PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); \ 915 break; \ 917 916 case PS_TYPE_F32: \ 918 917 PSIMAGE_ROTATE_ARBITRARY_LOOP(F32,MODE); \ -
trunk/psLib/src/image/psImageManip.h
r2375 r2860 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $14 * @date $Date: 200 4-11-16 20:00:21$13 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-01-03 21:58:53 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 44 44 * All pixels outside of the rectangular region in complex space formed by 45 45 * the min and max input parameters are set to the value vmax (if either 46 * the real or imaginary portion exceeds the respective max values), or vmin. 46 * the real or imaginary portion exceeds the respective max values), or vmin. 47 47 * This function is defined for psC32, and psC64 imagery only. 48 48 * … … 93 93 * 1/scale. The scale, always a positive number, is equal in each dimension and 94 94 * specified the number of pixels used to define a new pixel in the output image. 95 * The output image is generated from all input image pixels. This function is 95 * The output image is generated from all input image pixels. This function is 96 96 * defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 97 97 * … … 110 110 /** Resample image to new scale. 111 111 * 112 * A new image is constructed in which the dimensions are increased by a 113 * factor of scale. The scale, always a positive number, is equal in each 114 * dimension. The output image is generated from all input image pixels. 115 * Each pixel in the output image is derived by interpolating between 112 * A new image is constructed in which the dimensions are increased by a 113 * factor of scale. The scale, always a positive number, is equal in each 114 * dimension. The output image is generated from all input image pixels. 115 * Each pixel in the output image is derived by interpolating between 116 116 * neighboring pixels using the specified interpolation method (mode). 117 117 * … … 127 127 /** Rotate the input image by given angle, specified in degrees. 128 128 * 129 * The output image must contain all of the pixels from the input image in 130 * their new frame. Pixels in the output image which do not map to input 131 * pixels should be set to exposed. The center of rotation is always the 132 * center pixel of the image. The rotation is specified in the sense that a 133 * positive angle is an anti-clockwise rotation. This function must be 134 * defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 129 * The output image must contain all of the pixels from the input image in 130 * their new frame. Pixels in the output image which do not map to input 131 * pixels should be set to exposed. The center of rotation is always the 132 * center pixel of the image. The rotation is specified in the sense that a 133 * positive angle is an anti-clockwise rotation. This function must be 134 * defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 135 135 * psC32, psC64. 136 136 * … … 140 140 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 141 141 const psImage* in, ///< input image 142 float angle, ///< the rotation angle in degrees.142 float angle, ///< the rotation angle in radians. 143 143 psC64 unexposedValue, ///< the output image pixel values for non-imagery areas 144 144 psImageInterpolateMode mode ///< the interpolation mode used … … 147 147 /** Shift image by an arbitrary number of pixels (dx,dy) in either direction. 148 148 * 149 * If the shift values are fractional, the output pixel values should 150 * interpolate between the input pixel values. The output image has the same 151 * dimensions as the input image. Pixels which fall off the edge of the 152 * output image are lost. Newly exposed pixels are set to the value given by 153 * exposed. This function must be defined for the following types: psU8, 149 * If the shift values are fractional, the output pixel values should 150 * interpolate between the input pixel values. The output image has the same 151 * dimensions as the input image. Pixels which fall off the edge of the 152 * output image are lost. Newly exposed pixels are set to the value given by 153 * exposed. This function must be defined for the following types: psU8, 154 154 * psU16, psS8, psS16, psF32, psF64, psC32, psC64. 155 155 * … … 166 166 167 167 /** Roll image by an integer number of pixels in either direction. 168 * 168 * 169 169 * The output image is the same dimensions as the input image. Edge pixels 170 * wrap to the other side (no values are lost). This function is 170 * wrap to the other side (no values are lost). This function is 171 171 * defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 172 172 *
Note:
See TracChangeset
for help on using the changeset viewer.
