Changeset 3717 for trunk/psModules/src/pmObjects.c
- Timestamp:
- Apr 19, 2005, 12:58:48 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmObjects.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmObjects.c
r3701 r3717 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-04-1 4 03:27:50$7 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-04-19 22:58:48 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 45 45 tmp->y = 0.0; 46 46 tmp->Sx = 0.0; 47 tmp->S x= 0.0;47 tmp->Sy = 0.0; 48 48 tmp->Sxy = 0.0; 49 49 tmp->Sum = 0.0; … … 325 325 psError(PS_ERR_UNKNOWN, true, "Currently, input image must have at least 2 rows and 2 columns."); 326 326 } 327 psPeakType myPeakClass = PM_PEAK_UNDEF; 327 328 psVector *tmpRow = NULL; 328 329 psU32 col = 0; … … 343 344 // 344 345 if (col == 0) { 345 if ( (image->data.F32[row][col] > image->data.F32[row][col+1]) && 346 if ( (image->data.F32[row][col] > threshold) && 347 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 346 348 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 347 349 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 348 if (image->data.F32[row][col] > threshold) { 349 list = MyListAddPeak(list, col, row, image->data.F32[row][col], PM_PEAK_EDGE); 350 myPeakClass = PM_PEAK_EDGE; 351 if (image->data.F32[row][col] > image->data.F32[row+1][col+1]) { 352 myPeakClass|= PM_PEAK_LONE; 353 } else { 354 myPeakClass|= PM_PEAK_FLAT; 350 355 } 356 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 351 357 } 352 358 } else if (col < (image->numCols - 1)) { 353 if ( (image->data.F32[row][col] >= image->data.F32[row][col-1]) && 359 if ( (image->data.F32[row][col] > threshold) && 360 (image->data.F32[row][col] >= image->data.F32[row][col-1]) && 354 361 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 355 362 (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) && 356 363 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 357 364 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 358 if (image->data.F32[row][col] > threshold) { 359 list = MyListAddPeak(list, col, row, image->data.F32[row][col], PM_PEAK_EDGE); 365 366 myPeakClass = PM_PEAK_EDGE; 367 if ( (image->data.F32[row][col] > image->data.F32[row][col-1]) && 368 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 369 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 370 myPeakClass|= PM_PEAK_LONE; 371 } else { 372 myPeakClass|= PM_PEAK_FLAT; 360 373 } 374 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 361 375 } 362 376 363 377 } else if (col == (image->numCols - 1)) { 364 if ( (image->data.F32[row][col] >= image->data.F32[row][col-1]) && 378 if ( (image->data.F32[row][col] > threshold) && 379 (image->data.F32[row][col] >= image->data.F32[row][col-1]) && 365 380 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 366 381 (image->data.F32[row][col] >= image->data.F32[row+1][col-1])) { 367 if (image->data.F32[row][col] > threshold) { 368 list = MyListAddPeak(list, col, row, image->data.F32[row][col], PM_PEAK_EDGE); 382 myPeakClass = PM_PEAK_EDGE; 383 if ( (image->data.F32[row][col] > image->data.F32[row][col-1]) && 384 (image->data.F32[row][col] > image->data.F32[row+1][col-1])) { 385 myPeakClass|= PM_PEAK_LONE; 386 } else { 387 myPeakClass|= PM_PEAK_FLAT; 369 388 } 389 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 370 390 } 371 372 391 } else { 373 psError(PS_ERR_UNKNOWN, true, "peak specified valid column range.");392 psError(PS_ERR_UNKNOWN, true, "peak specified outside valid column range."); 374 393 } 375 394 } … … 390 409 // Step through all local peaks in this row. 391 410 for (psU32 i = 0 ; i < row1->n ; i++ ) { 392 psPeakType myType = PM_PEAK_UNDEF;393 411 col = row1->data.U32[i]; 394 412 395 413 if (col == 0) { 396 414 // If col==0, then we can not read col-1 pixels 397 if ((image->data.F32[row][col] > image->data.F32[row-1][col]) && 415 if ((image->data.F32[row][col] > threshold) && 416 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 398 417 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 399 418 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 400 419 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 401 420 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 402 myType = PM_PEAK_EDGE; 403 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myType); 421 422 myPeakClass = PM_PEAK_EDGE; 423 if ((image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 424 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 425 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 426 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 427 myPeakClass|= PM_PEAK_LONE; 428 } else { 429 myPeakClass|= PM_PEAK_FLAT; 430 } 431 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 404 432 } 405 433 } else if (col < (image->numCols - 1)) { 406 434 // This is an interior pixel 407 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 435 if ((image->data.F32[row][col] > threshold) && 436 (image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 408 437 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 409 438 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && … … 413 442 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 414 443 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 415 if (image->data.F32[row][col] > threshold) { 416 if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 417 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 418 (image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 419 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 420 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 421 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 422 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 423 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 424 myType = PM_PEAK_LONE; 425 } 426 427 if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) || 428 (image->data.F32[row][col] == image->data.F32[row-1][col]) || 429 (image->data.F32[row][col] == image->data.F32[row-1][col+1]) || 430 (image->data.F32[row][col] == image->data.F32[row][col-1]) || 431 (image->data.F32[row][col] == image->data.F32[row][col+1]) || 432 (image->data.F32[row][col] == image->data.F32[row+1][col-1]) || 433 (image->data.F32[row][col] == image->data.F32[row+1][col]) || 434 (image->data.F32[row][col] == image->data.F32[row+1][col+1])) { 435 myType = PM_PEAK_FLAT; 436 } 437 438 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myType); 444 445 if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 446 (image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 447 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 448 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 449 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 450 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 451 myPeakClass = PM_PEAK_LONE; 452 } else { 453 myPeakClass = PM_PEAK_FLAT; 439 454 } 455 456 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 440 457 } 441 458 } else if (col == (image->numCols - 1)) { 442 459 // If col==numCols - 1, then we can not read col+1 pixels 443 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 460 if ((image->data.F32[row][col] > threshold) && 461 (image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 444 462 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 445 463 (image->data.F32[row][col] > image->data.F32[row][col-1]) && … … 447 465 (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) && 448 466 (image->data.F32[row][col] >= image->data.F32[row+1][col])) { 449 myType = PM_PEAK_EDGE; 450 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myType); 467 468 myPeakClass = PM_PEAK_EDGE; 469 if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 470 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 471 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 472 (image->data.F32[row][col] > image->data.F32[row+1][col])) { 473 myPeakClass|= PM_PEAK_LONE; 474 } else { 475 myPeakClass|= PM_PEAK_FLAT; 476 } 477 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 451 478 } 452 479 } else { 453 psError(PS_ERR_UNKNOWN, true, "peak specified valid column range.");480 psError(PS_ERR_UNKNOWN, true, "peak specified outside valid column range."); 454 481 } 455 456 482 } 457 483 } … … 466 492 col = row1->data.U32[i]; 467 493 if (col == 0) { 468 if ( (image->data.F32[row][col] > image->data.F32[row-1][col]) && 494 if ( (image->data.F32[row][col] > threshold) && 495 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 469 496 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 470 497 (image->data.F32[row][col] > image->data.F32[row][col+1])) { 471 if (image->data.F32[row][col] > threshold) { 472 list = MyListAddPeak(list, col, row, image->data.F32[row][col], PM_PEAK_EDGE); 498 499 myPeakClass = PM_PEAK_EDGE; 500 if (image->data.F32[row][col] > image->data.F32[row-1][col+1]) { 501 myPeakClass|= PM_PEAK_LONE; 502 } else { 503 myPeakClass|= PM_PEAK_FLAT; 473 504 } 505 506 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 474 507 } 475 508 } else if (col < (image->numCols - 1)) { 476 if ( (image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 509 if ( (image->data.F32[row][col] > threshold) && 510 (image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 477 511 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 478 512 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 479 513 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 480 514 (image->data.F32[row][col] >= image->data.F32[row][col+1])) { 481 if (image->data.F32[row][col] > threshold) { 482 list = MyListAddPeak(list, col, row, image->data.F32[row][col], PM_PEAK_EDGE); 515 516 myPeakClass = PM_PEAK_EDGE; 517 if ( (image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 518 (image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 519 (image->data.F32[row][col] > image->data.F32[row][col+1])) { 520 myPeakClass|= PM_PEAK_LONE; 521 } else { 522 myPeakClass|= PM_PEAK_FLAT; 483 523 } 524 525 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 484 526 } 485 527 486 528 } else if (col == (image->numCols - 1)) { 487 if ( (image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 529 if ( (image->data.F32[row][col] > threshold) && 530 (image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 488 531 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 489 532 (image->data.F32[row][col] > image->data.F32[row][col-1])) { 490 if (image->data.F32[row][col] > threshold) { 491 list = MyListAddPeak(list, col, row, image->data.F32[row][col], PM_PEAK_EDGE); 533 534 myPeakClass = PM_PEAK_EDGE; 535 if (image->data.F32[row][col] > image->data.F32[row-1][col-1]) { 536 myPeakClass|= PM_PEAK_LONE; 537 } else { 538 myPeakClass|= PM_PEAK_FLAT; 492 539 } 540 541 list = MyListAddPeak(list, col, row, image->data.F32[row][col], myPeakClass); 493 542 } 494 543 } else { … … 600 649 psS32 SubImageCenterRow = peak->y; 601 650 psS32 SubImageCenterCol = peak->x; 602 psS32 SubImageStartRow = SubImageCenterRow - outerRadiusS32;603 psS32 SubImageEndRow = SubImageCenterRow + outerRadiusS32;604 psS32 SubImageStartCol = SubImageCenterCol - outerRadiusS32;605 psS32 SubImageEndCol = SubImageCenterCol + outerRadiusS32;651 psS32 SubImageStartRow = PS_MAX(SubImageCenterRow - outerRadiusS32, 0); 652 psS32 SubImageEndRow = PS_MIN(SubImageCenterRow + outerRadiusS32, image->numRows - 1); 653 psS32 SubImageStartCol = PS_MAX(SubImageCenterCol - outerRadiusS32, 0); 654 psS32 SubImageEndCol = PS_MIN(SubImageCenterCol + outerRadiusS32, image->numCols - 1); 606 655 // AnulusWidth == number of pixels width in the annulus. We add one since 607 656 // the pixels at the inner AND outher radius are included.
Note:
See TracChangeset
for help on using the changeset viewer.
