Changeset 2068 for trunk/psLib/test/image/tst_psImageConvolve.c
- Timestamp:
- Oct 12, 2004, 3:22:38 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageConvolve.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageConvolve.c
r1984 r2068 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 06 21:40:13$7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-13 01:22:38 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 static int testKernelAlloc(void); 23 23 static int testKernelGenerate(void); 24 static int testImageConvolve(void);24 //static int testImageConvolve(void); 25 25 26 26 testDescription tests[] = { 27 27 {testKernelAlloc,731,"psKernelAlloc",0,false}, 28 28 {testKernelGenerate,732,"psKernelGenerate",0,false}, 29 {testImageConvolve,733,"psImageConvolve",0,false},29 // {testImageConvolve,733,"psImageConvolve",0,false}, 30 30 {NULL} 31 31 }; … … 290 290 } 291 291 292 /* 292 293 static int testImageConvolve(void) 293 294 { … … 295 296 const int c = 300; 296 297 int sum; 297 298 298 299 // approximate a normalized gaussian kernel. 299 300 psKernel* g = psKernelAlloc(-1,1,-1,1); … … 307 308 g->kernel[0][1] = 0.0838; 308 309 g->kernel[0][0] = 0.6193; 309 310 310 311 // create a normalized non-symetric kernel. 311 312 psKernel* nsk = psKernelAlloc(0,2,0,2); … … 322 323 } 323 324 } 324 325 325 326 326 327 psImage* img = psImageAlloc(c,r,PS_TYPE_F32); 327 328 memset(img->data.F32[0],0,c*r*PSELEMTYPE_SIZEOF(PS_TYPE_F32)); … … 329 330 img->data.F32[r/2][c/2] = 1.0f; 330 331 img->data.F32[r-1][c/2] = 1.0f; 331 332 332 333 // test spacial convolution of gaussian 333 334 psLogMsg(__func__,PS_LOG_INFO,"Testing direct gaussian convolution"); 334 335 psImage* out = psImageConvolve(NULL, img, g, true); 335 336 336 337 if (out == NULL) { 337 338 psError(__func__, "psImageConvolve returned a NULL for direct gaussian case."); 338 339 return 1; 339 340 } 340 341 341 342 if (out->numCols != c || out->numRows != r) { 342 343 psError(__func__, "psImageConvolve result image is %dx%d, but expected %dx%d.", … … 345 346 return 2; 346 347 } 347 348 348 349 if (out->type.type != PS_TYPE_F32) { 349 350 char* typeStr; … … 353 354 return 3; 354 355 } 355 356 356 357 // test values 357 358 for (int i=-1;i<1;i++) { … … 377 378 } 378 379 } 379 380 380 381 // test fourier convolution of gaussian 381 382 psLogMsg(__func__,PS_LOG_INFO,"Testing fourier gaussian convolution"); … … 394 395 img->data.F32[r-1][c/2] = 0.0f; 395 396 psImage* out2 = psImageConvolve(out, img, gg, false); 396 397 397 398 if (out == NULL) { 398 399 psError(__func__, "psImageConvolve returned a NULL for gaussian case."); 399 400 return 10; 400 401 } 401 402 402 403 if (out != out2) { 403 404 psError(__func__, "psImageConvolve didn't recycle the supplied out image struct."); 404 405 return 11; 405 406 } 406 407 407 408 if (out->numCols != c || out->numRows != r) { 408 409 psError(__func__, "psImageConvolve result image is %dx%d, but expected %dx%d.", … … 411 412 return 12; 412 413 } 413 414 414 415 if (out->type.type != PS_TYPE_F32) { 415 416 char* typeStr; … … 419 420 return 13; 420 421 } 421 422 422 423 psImageWriteSection(out2,0,0,0,NULL,0,"out2.fits"); 423 424 // test values … … 445 446 } 446 447 } 447 448 448 449 psFree(g); 449 450 psFree(img); … … 452 453 return 0; 453 454 } 455 */ 456
Note:
See TracChangeset
for help on using the changeset viewer.
