Changeset 2762 for trunk/psLib/src/imageops/psImageStats.c
- Timestamp:
- Dec 20, 2004, 11:39:42 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageStats.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageStats.c
r2736 r2762 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12- 16 21:58:55$11 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-20 21:39:42 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 450 450 XXX: Use static variables for Chebyshev polynomials and scaling factors. 451 451 *****************************************************************************/ 452 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs) 453 { 454 PS_IMAGE_CHECK_NULL(input, NULL); 455 PS_IMAGE_CHECK_EMPTY(input, NULL); 456 if ((input->type.type != PS_TYPE_S8) && 457 (input->type.type != PS_TYPE_U16) && 458 (input->type.type != PS_TYPE_F32) && 459 (input->type.type != PS_TYPE_F64)) { 460 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 461 "Unallowable image type.\n"); 462 } 463 PS_POLY_CHECK_NULL(coeffs, NULL); 452 psImage* p_psImageEvalPolynomialCheb(psImage* input, 453 const psPolynomial2D* coeffs) 454 { 464 455 PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL); 465 456 … … 525 516 return input; 526 517 } 518 519 psImage* p_psImageEvalPolynomialOrd(psImage* input, 520 const psPolynomial2D* coeffs) 521 { 522 PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_ORD, NULL); 523 524 for (int row = 0; row < input->numRows ; row++) { 525 for (int col = 0; col < input->numCols ; col++) { 526 if (input->type.type == PS_TYPE_S8) { 527 input->data.S8[row][col] = (psS8) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 528 } else if (input->type.type == PS_TYPE_U16) { 529 input->data.U16[row][col] = (psS16) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 530 } else if (input->type.type == PS_TYPE_F32) { 531 input->data.F32[row][col] = psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 532 } else if (input->type.type == PS_TYPE_F64) { 533 input->data.F64[row][col] = (psF64) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 534 } 535 } 536 } 537 538 return(input); 539 } 540 541 542 /***************************************************************************** 543 XXX: I added normal polynomials to this routine. Let IfA know, put it in the 544 psLib SDR. 545 *****************************************************************************/ 546 psImage* psImageEvalPolynomial(psImage* input, 547 const psPolynomial2D* coeffs) 548 { 549 PS_IMAGE_CHECK_NULL(input, NULL); 550 PS_IMAGE_CHECK_EMPTY(input, NULL); 551 if ((input->type.type != PS_TYPE_S8) && 552 (input->type.type != PS_TYPE_U16) && 553 (input->type.type != PS_TYPE_F32) && 554 (input->type.type != PS_TYPE_F64)) { 555 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 556 "Unallowable image type.\n"); 557 } 558 PS_POLY_CHECK_NULL(coeffs, NULL); 559 560 if (coeffs->type == PS_POLYNOMIAL_ORD) { 561 return(p_psImageEvalPolynomialOrd(input, coeffs)); 562 } else if (coeffs->type == PS_POLYNOMIAL_CHEB) { 563 return(p_psImageEvalPolynomialCheb(input, coeffs)); 564 } 565 printf("XXX: Error: wrong polynomial type\n"); 566 // XXX: psError() 567 return(NULL); 568 } 569
Note:
See TracChangeset
for help on using the changeset viewer.
