IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3625 for trunk/psModules/src


Ignore:
Timestamp:
Apr 1, 2005, 10:47:40 AM (21 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psModules/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmObjects.c

    r3576 r3625  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-03-31 00:22:49 $
     7 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-04-01 20:47:40 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    147147
    148148/******************************************************************************
    149 pmFindVectorPeeks(vector, threshold): Find all local peaks in the given vector
     149pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
    150150above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
    151151the location (x value) of all peaks.
     
    157157Depending upon actual use, this may need to be optimized.
    158158 *****************************************************************************/
    159 psVector *pmFindVectorPeeks(const psVector *vector,
     159psVector *pmFindVectorPeaks(const psVector *vector,
    160160                            psF32 threshold)
    161161{
     
    267267MyListAddPeak(): A private function which allocates a psList, if the list
    268268argument is NULL, otherwise it adds the peak to that list.
    269  *****************************************************************************/
    270 // XXX: Switch row, col args?
     269 
     270XXX: Switch row, col args?
     271 *****************************************************************************/
    271272psList *MyListAddPeak(psList *list,
    272273                      psS32 row,
     
    275276                      psPeakType type)
    276277{
    277     psPeak *tmpPeak = pmPeakAlloc(col, row, counts, type);
     278    psPeak *tmpPeak = pmPeakAlloc(row, col, counts, type);
    278279
    279280    if (list == NULL) {
     
    287288
    288289/******************************************************************************
    289 pmFindImagePeeks(image, threshold): Find all local peaks in the given psImage
     290pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
    290291above the given threshold.  Returns a psList containing location (x/y value)
    291292of all peaks.
     
    301302     Currently, we do not.
    302303 *****************************************************************************/
    303 psList *pmFindImagePeeks(const psImage *image,
     304psList *pmFindImagePeaks(const psImage *image,
    304305                         psF32 threshold)
    305306{
     
    319320    row = 0;
    320321    tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);
    321     psVector *row1 = pmFindVectorPeeks(tmpRow, threshold);
     322    psVector *row1 = pmFindVectorPeaks(tmpRow, threshold);
    322323    for (psU32 i = 0 ; i < row1->n ; i++ ) {
    323324        col = row1->data.U32[i];
     
    355356
    356357        } else {
    357             psError(PS_ERR_UNKNOWN, true, "peak specified valid colum range.");
     358            psError(PS_ERR_UNKNOWN, true, "peak specified valid column range.");
    358359        }
    359360    }
     
    370371    for (row = 1 ; row < (image->numRows - 1) ; row++) {
    371372        tmpRow = p_psGetRowVectorFromImage((psImage *) image, 0);
    372         row1 = pmFindVectorPeeks(tmpRow, threshold);
    373 
    374         // Step through all local peask in this row.
     373        row1 = pmFindVectorPeaks(tmpRow, threshold);
     374
     375        // Step through all local peaks in this row.
    375376        for (psU32 i = 0 ; i < row1->n ; i++ ) {
     377            psPeakType myType = PM_PEAK_UNDEF;
    376378            col = row1->data.U32[i];
    377379
    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;
    410388                    list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);
    411389                }
     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.");
    412439            }
     440
    413441        }
    414442    }
     
    419447    row = image->numRows - 1;
    420448    tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);
    421     row1 = pmFindVectorPeeks(tmpRow, threshold);
     449    row1 = pmFindVectorPeaks(tmpRow, threshold);
    422450    for (psU32 i = 0 ; i < row1->n ; i++ ) {
    423451        col = row1->data.U32[i];
     
    482510XXX: warning message if valid is NULL?
    483511 *****************************************************************************/
    484 psList *pmCullPeeks(psList *peaks,
     512psList *pmCullPeaks(psList *peaks,
    485513                    psF32 maxValue,
    486514                    const psRegion *valid)
     
    492520    psS32 indexNum = 0;
    493521
    494     //    printf("pmCullPeeks(): list size is %d\n", peaks->size);
     522    //    printf("pmCullPeaks(): list size is %d\n", peaks->size);
    495523    while (tmpListElem != NULL) {
    496524        psPeak *tmpPeak = (psPeak *) tmpListElem->data;
  • trunk/psModules/src/pmObjects.h

    r3600 r3625  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-03-31 23:45:22 $
     7 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-04-01 20:47:40 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    110110
    111111/******************************************************************************
    112 pmFindVectorPeeks(vector, threshold): Find all local peaks in the given vector
     112pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
    113113above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
    114114the location (x value) of all peaks.
     
    119119
    120120/******************************************************************************
    121 pmFindImagePeeks(image, threshold): Find all local peaks in the given psImage
     121pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
    122122above the given threshold.  Returns a psList containing the location (x/y
    123123value) of all peaks.
Note: See TracChangeset for help on using the changeset viewer.