Changeset 3625 for trunk/psModules/src/pmObjects.c
- Timestamp:
- Apr 1, 2005, 10:47:40 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmObjects.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmObjects.c
r3576 r3625 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-0 3-31 00:22:49$7 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-04-01 20:47:40 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 147 147 148 148 /****************************************************************************** 149 pmFindVectorPe eks(vector, threshold): Find all local peaks in the given vector149 pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector 150 150 above the given threshold. Returns a vector of type PS_TYPE_U32 containing 151 151 the location (x value) of all peaks. … … 157 157 Depending upon actual use, this may need to be optimized. 158 158 *****************************************************************************/ 159 psVector *pmFindVectorPe eks(const psVector *vector,159 psVector *pmFindVectorPeaks(const psVector *vector, 160 160 psF32 threshold) 161 161 { … … 267 267 MyListAddPeak(): A private function which allocates a psList, if the list 268 268 argument is NULL, otherwise it adds the peak to that list. 269 *****************************************************************************/ 270 // XXX: Switch row, col args? 269 270 XXX: Switch row, col args? 271 *****************************************************************************/ 271 272 psList *MyListAddPeak(psList *list, 272 273 psS32 row, … … 275 276 psPeakType type) 276 277 { 277 psPeak *tmpPeak = pmPeakAlloc( col, row, counts, type);278 psPeak *tmpPeak = pmPeakAlloc(row, col, counts, type); 278 279 279 280 if (list == NULL) { … … 287 288 288 289 /****************************************************************************** 289 pmFindImagePe eks(image, threshold): Find all local peaks in the given psImage290 pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage 290 291 above the given threshold. Returns a psList containing location (x/y value) 291 292 of all peaks. … … 301 302 Currently, we do not. 302 303 *****************************************************************************/ 303 psList *pmFindImagePe eks(const psImage *image,304 psList *pmFindImagePeaks(const psImage *image, 304 305 psF32 threshold) 305 306 { … … 319 320 row = 0; 320 321 tmpRow = p_psGetRowVectorFromImage((psImage *) image, row); 321 psVector *row1 = pmFindVectorPe eks(tmpRow, threshold);322 psVector *row1 = pmFindVectorPeaks(tmpRow, threshold); 322 323 for (psU32 i = 0 ; i < row1->n ; i++ ) { 323 324 col = row1->data.U32[i]; … … 355 356 356 357 } else { 357 psError(PS_ERR_UNKNOWN, true, "peak specified valid colum range.");358 psError(PS_ERR_UNKNOWN, true, "peak specified valid column range."); 358 359 } 359 360 } … … 370 371 for (row = 1 ; row < (image->numRows - 1) ; row++) { 371 372 tmpRow = p_psGetRowVectorFromImage((psImage *) image, 0); 372 row1 = pmFindVectorPe eks(tmpRow, threshold);373 374 // Step through all local pea skin this row.373 row1 = pmFindVectorPeaks(tmpRow, threshold); 374 375 // Step through all local peaks in this row. 375 376 for (psU32 i = 0 ; i < row1->n ; i++ ) { 377 psPeakType myType = PM_PEAK_UNDEF; 376 378 col = row1->data.U32[i]; 377 379 378 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 379 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 380 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 381 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 382 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 383 (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) && 384 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 385 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 386 if (image->data.F32[row][col] > threshold) { 387 388 psPeakType myType = PM_PEAK_UNDEF; 389 if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 390 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 391 (image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 392 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 393 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 394 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 395 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 396 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 397 myType = PM_PEAK_LONE; 398 } 399 if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) || 400 (image->data.F32[row][col] == image->data.F32[row-1][col]) || 401 (image->data.F32[row][col] == image->data.F32[row-1][col+1]) || 402 (image->data.F32[row][col] == image->data.F32[row][col-1]) || 403 (image->data.F32[row][col] == image->data.F32[row][col+1]) || 404 (image->data.F32[row][col] == image->data.F32[row+1][col-1]) || 405 (image->data.F32[row][col] == image->data.F32[row+1][col]) || 406 (image->data.F32[row][col] == image->data.F32[row+1][col+1])) { 407 myType = PM_PEAK_FLAT; 408 } 409 380 if (col == 0) { 381 // If col==0, then we can not read col-1 pixels 382 if ((image->data.F32[row][col] > image->data.F32[row-1][col]) && 383 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 384 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 385 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 386 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 387 myType = PM_PEAK_EDGE; 410 388 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType); 411 389 } 390 } else if (col < (image->numCols - 1)) { 391 // This is an interior pixel 392 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 393 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 394 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 395 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 396 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 397 (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) && 398 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 399 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 400 if (image->data.F32[row][col] > threshold) { 401 if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 402 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 403 (image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 404 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 405 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 406 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 407 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 408 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 409 myType = PM_PEAK_LONE; 410 } 411 412 if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) || 413 (image->data.F32[row][col] == image->data.F32[row-1][col]) || 414 (image->data.F32[row][col] == image->data.F32[row-1][col+1]) || 415 (image->data.F32[row][col] == image->data.F32[row][col-1]) || 416 (image->data.F32[row][col] == image->data.F32[row][col+1]) || 417 (image->data.F32[row][col] == image->data.F32[row+1][col-1]) || 418 (image->data.F32[row][col] == image->data.F32[row+1][col]) || 419 (image->data.F32[row][col] == image->data.F32[row+1][col+1])) { 420 myType = PM_PEAK_FLAT; 421 } 422 423 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType); 424 } 425 } 426 } else if (col == (image->numCols - 1)) { 427 // If col==numCols - 1, then we can not read col+1 pixels 428 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 429 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 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 myType = PM_PEAK_EDGE; 435 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType); 436 } 437 } else { 438 psError(PS_ERR_UNKNOWN, true, "peak specified valid column range."); 412 439 } 440 413 441 } 414 442 } … … 419 447 row = image->numRows - 1; 420 448 tmpRow = p_psGetRowVectorFromImage((psImage *) image, row); 421 row1 = pmFindVectorPe eks(tmpRow, threshold);449 row1 = pmFindVectorPeaks(tmpRow, threshold); 422 450 for (psU32 i = 0 ; i < row1->n ; i++ ) { 423 451 col = row1->data.U32[i]; … … 482 510 XXX: warning message if valid is NULL? 483 511 *****************************************************************************/ 484 psList *pmCullPe eks(psList *peaks,512 psList *pmCullPeaks(psList *peaks, 485 513 psF32 maxValue, 486 514 const psRegion *valid) … … 492 520 psS32 indexNum = 0; 493 521 494 // printf("pmCullPe eks(): list size is %d\n", peaks->size);522 // printf("pmCullPeaks(): list size is %d\n", peaks->size); 495 523 while (tmpListElem != NULL) { 496 524 psPeak *tmpPeak = (psPeak *) tmpListElem->data;
Note:
See TracChangeset
for help on using the changeset viewer.
