Changeset 2204 for trunk/psLib/src/imageops
- Timestamp:
- Oct 26, 2004, 2:57:34 PM (22 years ago)
- Location:
- trunk/psLib/src/imageops
- Files:
-
- 4 edited
-
psImageConvolve.c (modified) (17 diffs)
-
psImageConvolve.h (modified) (6 diffs)
-
psImageStats.c (modified) (9 diffs)
-
psImageStats.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageConvolve.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 06 21:31:30$7 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static void freeKernel(psKernel* ptr); 29 29 30 psKernel* psKernelAlloc( int xMin, int xMax, int yMin, intyMax)30 psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax) 31 31 { 32 32 psKernel* result; 33 intnumRows;34 intnumCols;33 psS32 numRows; 34 psS32 numCols; 35 35 36 36 // following is explicitly spelled out in the SDRS as a requirement … … 40 40 yMin, yMax); 41 41 42 inttemp = yMin;42 psS32 temp = yMin; 43 43 yMin = yMax; 44 44 yMax = temp; … … 51 51 xMin, xMax); 52 52 53 inttemp = xMin;53 psS32 temp = xMin; 54 54 xMin = xMax; 55 55 xMax = temp; … … 70 70 psKernelType** kernelRows = result->p_kernelRows; 71 71 psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA; 72 for ( inti = 0; i < numRows; i++) {72 for (psS32 i = 0; i < numRows; i++) { 73 73 kernelRows[i] = imageRows[i] - xMin; 74 74 } … … 91 91 const psVector* xShifts, 92 92 const psVector* yShifts, 93 bool relative)93 psBool relative) 94 94 { 95 intx = 0;96 inty = 0;97 intt = 0;98 intdeltaT;99 intoldX;100 intoldY;101 intxMin = 0;102 intxMax = 0;103 intyMin = 0;104 intyMax = 0;105 intlength = 0;95 psS32 x = 0; 96 psS32 y = 0; 97 psS32 t = 0; 98 psS32 deltaT; 99 psS32 oldX; 100 psS32 oldY; 101 psS32 xMin = 0; 102 psS32 xMax = 0; 103 psS32 yMin = 0; 104 psS32 yMax = 0; 105 psS32 length = 0; 106 106 psKernelType normalizeTime = 1.0; // fraction of total time for each shift clock 107 107 psKernel* result = NULL; … … 153 153 y = 0; \ 154 154 t = 0; \ 155 for ( intlcv = 0; lcv < length; lcv++) { \155 for (psS32 lcv = 0; lcv < length; lcv++) { \ 156 156 if (relative) { \ 157 157 x += xShiftData[lcv]; \ … … 181 181 y = 0; \ 182 182 t = 0; \ 183 for ( inti = 0; i < length; i++) { \183 for (psS32 i = 0; i < length; i++) { \ 184 184 deltaT = t; \ 185 185 oldX = x; \ … … 228 228 } 229 229 230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct) 231 231 { 232 232 if (in == NULL) { … … 242 242 return NULL; 243 243 } 244 intxMin = kernel->xMin;245 intxMax = kernel->xMax;246 intyMin = kernel->yMin;247 intyMax = kernel->yMax;244 psS32 xMin = kernel->xMin; 245 psS32 xMax = kernel->xMax; 246 psS32 yMin = kernel->yMin; 247 psS32 yMax = kernel->yMax; 248 248 psKernelType** kData = kernel->kernel; 249 249 250 250 // make the output image to the proper size and type 251 intnumRows = in->numRows;252 intnumCols = in->numCols;251 psS32 numRows = in->numRows; 252 psS32 numCols = in->numCols; 253 253 254 254 … … 261 261 ps##TYPE** inData = in->data.TYPE; \ 262 262 out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \ 263 for ( introw=0;row<numRows;row++) { \263 for (psS32 row=0;row<numRows;row++) { \ 264 264 ps##TYPE* outRow = out->data.TYPE[row]; \ 265 for ( intcol=0;col<numCols;col++) { \265 for (psS32 col=0;col<numCols;col++) { \ 266 266 ps##TYPE pixel = 0.0; \ 267 for ( intkRow = yMin; kRow < yMax; kRow++) { \267 for (psS32 kRow = yMin; kRow < yMax; kRow++) { \ 268 268 if (row-kRow >= 0 && row-kRow < numRows) { \ 269 for ( intkCol = xMin; kCol < xMax; kCol++) { \269 for (psS32 kCol = xMin; kCol < xMax; kCol++) { \ 270 270 if (col-kCol >= 0 && col-kCol < numCols) { \ 271 271 pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \ … … 310 310 } else { 311 311 // fourier convolution 312 intpaddedCols = numCols+2*FOURIER_PADDING;313 intpaddedRows = numRows+2*FOURIER_PADDING;312 psS32 paddedCols = numCols+2*FOURIER_PADDING; 313 psS32 paddedRows = numRows+2*FOURIER_PADDING; 314 314 315 315 // check to see if kernel is smaller, otherwise padding it up will fail. 316 intkRows = kernel->image->numRows;317 intkCols = kernel->image->numCols;316 psS32 kRows = kernel->image->numRows; 317 psS32 kCols = kernel->image->numCols; 318 318 if (kRows >= numRows || kCols >= numCols) { 319 319 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve", … … 328 328 // pad the image 329 329 psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type); 330 intelementSize = PSELEMTYPE_SIZEOF(in->type.type);330 psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type); 331 331 332 332 // zero out padded area on top and bottom … … 335 335 336 336 // fill in the image-containing rows. 337 intsidePaddingSize = FOURIER_PADDING*elementSize;338 intimageRowSize = numCols*elementSize;337 psS32 sidePaddingSize = FOURIER_PADDING*elementSize; 338 psS32 imageRowSize = numCols*elementSize; 339 339 psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING]; 340 for ( introw=0;row<numRows;row++) {340 for (psS32 row=0;row<numRows;row++) { 341 341 // zero out padded area on left edge. 342 342 memset(paddedData,0,sidePaddingSize); … … 354 354 psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL); 355 355 memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image 356 intyMax = kernel->yMax;357 intxMax = kernel->xMax;358 for ( introw = kernel->yMin; row <= yMax;row++) {359 intpadRow = row;356 psS32 yMax = kernel->yMax; 357 psS32 xMax = kernel->xMax; 358 for (psS32 row = kernel->yMin; row <= yMax;row++) { 359 psS32 padRow = row; 360 360 if (padRow < 0) { 361 361 padRow += paddedRows; … … 363 363 psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow]; 364 364 psKernelType* kernelRow = kernel->kernel[row]; 365 for ( intcol = kernel->xMin; col <= xMax; col++) {365 for (psS32 col = kernel->xMin; col <= xMax; col++) { 366 366 if (col < 0) { 367 367 padData[col+paddedCols] = kernelRow[col]; … … 418 418 out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32); 419 419 float factor = 1.0f/numCols/numRows; 420 for ( introw = 0; row < numRows; row++) {420 for (psS32 row = 0; row < numRows; row++) { 421 421 psF32* outRow = out->data.F32[row]; 422 422 psC32* resultRow = complexOutSansPad->data.C32[row]; 423 for ( intcol = 0; col < numCols; col++) {423 for (psS32 col = 0; col < numCols; col++) { 424 424 outRow[col] = crealf(resultRow[col])*factor; 425 425 } -
trunk/psLib/src/imageops/psImageConvolve.h
r1863 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2004- 09-23 18:30:57$9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #ifndef PS_IMAGE_CONVOLVE_H 16 16 #define PS_IMAGE_CONVOLVE_H 17 18 #include<stdbool.h>19 17 20 18 #include "psImage.h" … … 32 30 { 33 31 psImage* image; ///< Kernel data, in the form of an image 34 intxMin; ///< Most negative x index35 intyMin; ///< Most negative y index36 intxMax; ///< Most positive x index37 intyMax; ///< Most positive y index32 psS32 xMin; ///< Most negative x index 33 psS32 yMin; ///< Most negative y index 34 psS32 xMax; ///< Most positive x index 35 psS32 yMax; ///< Most positive y index 38 36 psKernelType** kernel; ///< Pointer to the kernel data 39 37 psKernelType** p_kernelRows; ///< Pointer to the rows of the kernel data; not intended for user use. … … 68 66 */ 69 67 psKernel* psKernelAlloc( 70 intxMin, ///< Most negative x index71 intxMax, ///< Most positive x index72 intyMin, ///< Most negative y index73 intyMax ///< Most positive y index68 psS32 xMin, ///< Most negative x index 69 psS32 xMax, ///< Most positive x index 70 psS32 yMin, ///< Most negative y index 71 psS32 yMax ///< Most positive y index 74 72 ); 75 73 … … 94 92 const psVector* xShifts, ///< list of x-axis shifts 95 93 const psVector* yShifts, ///< list of y-axis shifts 96 bool relative94 psBool relative 97 95 ); 98 96 … … 118 116 const psImage* in, ///< the psImage to convolve 119 117 const psKernel* kernel, ///< kernel to colvolve with 120 bool direct ///< specifies method, true=direct convolution, false=fourier118 psBool direct ///< specifies method, true=direct convolution, false=fourier 121 119 ); 122 120 -
trunk/psLib/src/imageops/psImageStats.c
r2102 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.4 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 14 01:06:44$11 * @version $Revision: 1.44 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, 41 41 psImage* mask, 42 intmaskVal)42 psS32 maskVal) 43 43 { 44 44 psVector* junkData = NULL; … … 106 106 psImage* in, 107 107 psImage* mask, 108 unsigned intmaskVal)108 psU32 maskVal) 109 109 { 110 110 psVector* junkData = NULL; … … 150 150 151 151 // XXX: Why do we have this function? 152 float *p_psCalcScaleFactorsFit( intn)153 { 154 inti = 0;152 float *p_psCalcScaleFactorsFit(psS32 n) 153 { 154 psS32 i = 0; 155 155 float tmp = 0.0; 156 156 float *scalingFactors = (float *)psAlloc(n * sizeof(float)); … … 175 175 output a vector of evenly spaced floating point values between -1.0:1.0. 176 176 *****************************************************************************/ 177 float *p_psCalcScaleFactorsEval( intn)178 { 179 inti = 0;177 float *p_psCalcScaleFactorsEval(psS32 n) 178 { 179 psS32 i = 0; 180 180 float tmp = 0.0; 181 181 … … 196 196 197 197 // XXX: Use a static array of CHebyshev polynomials. 198 psPolynomial1D **p_psCreateChebyshevPolys( intmaxChebyPoly)198 psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly) 199 199 { 200 200 if (maxChebyPoly < 1) { … … 202 202 } 203 203 psPolynomial1D **chebPolys = NULL; 204 inti = 0;205 intj = 0;204 psS32 i = 0; 205 psS32 j = 0; 206 206 207 207 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); … … 245 245 const psImage* input) 246 246 { 247 intx = 0;248 inty = 0;249 inti = 0;250 intj = 0;247 psS32 x = 0; 248 psS32 y = 0; 249 psS32 i = 0; 250 psS32 j = 0; 251 251 float **sums = NULL; 252 252 psPolynomial1D* *chebPolys = NULL; 253 intmaxChebyPoly = 0;253 psS32 maxChebyPoly = 0; 254 254 float *cScalingFactors = NULL; 255 255 float *rScalingFactors = NULL; … … 365 365 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs) 366 366 { 367 intx = 0;368 inty = 0;369 inti = 0;370 intj = 0;367 psS32 x = 0; 368 psS32 y = 0; 369 psS32 i = 0; 370 psS32 j = 0; 371 371 // float **sums = NULL; 372 372 psPolynomial1D* *chebPolys = NULL; 373 intmaxChebyPoly = 0;373 psS32 maxChebyPoly = 0; 374 374 float *cScalingFactors = NULL; 375 375 float *rScalingFactors = NULL; -
trunk/psLib/src/imageops/psImageStats.h
r1951 r2204 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 05 01:03:11 $11 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, ///< image (or subimage) to calculate stats 41 41 psImage* mask, ///< mask data for image (NULL ok) 42 intmaskVal ///< mask Mask for mask42 psS32 maskVal ///< mask Mask for mask 43 43 ); 44 44 … … 55 55 psImage* in, ///< Image data to be histogramed. 56 56 psImage* mask, ///< mask data for image (NULL ok) 57 unsigned intmaskVal ///< mask Mask for mask57 psU32 maskVal ///< mask Mask for mask 58 58 ); 59 59
Note:
See TracChangeset
for help on using the changeset viewer.
