IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 16, 2004, 4:14:52 PM (22 years ago)
Author:
gusciora
Message:

Added vector bin disect table lookup type methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psStats.c

    r1722 r1823  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-08 06:04:30 $
     11 *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-17 02:14:52 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    14491449void p_ps_FitTheGaussian()
    14501450{
    1451  
    14521451    // Fit a Gaussian to the bins in the range MODE-dL to Mode+dL
    14531452    // NOTE: This code uses the psMinimize.c functions to perform
     
    14551454    // I am commenting this code out, and replacing it with code which
    14561455    // calculates the mean directly on the robustHistogram.
     1456    //
     1457    // XXX: Replace this with the LaGrange interpolation stuff.
    14571458 
    14581459    domain = psImageAlloc(1, robustHistogramVector->n, PS_TYPE_F32);
     
    16711672psHistogram* psVectorHistogram(psHistogram* out,
    16721673                               const psVector* restrict in,
    1673                                const psVector* restrict mask, unsigned int maskVal)
     1674                               const psVector* restrict mask,
     1675                               unsigned int maskVal)
    16741676{
    16751677    int i = 0;                  // Loop index variable
    1676     int j = 0;                  // Loop index variable
    16771678    float binSize = 0.0;        // Histogram bin size
    16781679    int binNum = 0;             // A temporary bin number
    16791680    int numBins = 0;            // The total number of bins
     1681    int tmp = 0;
     1682    psScalar tmpScalar;
     1683    tmpScalar.type.type = PS_TYPE_F32;
    16801684
    16811685    // NOTE: Verify that this is the correct action.
     
    17081712        }
    17091713    }
     1714
    17101715    // NOTE: determine the correct action for a variety of other cases:
    17111716    // in vector has 0 elements, and histogram structure has zero bins.
     
    17421747                    // bin number requires a bit more work.
    17431748                } else {
    1744                     // NOTE: This is slow.  Put a smarter algorithm here to
    1745                     // find the correct bin number (bin search, probably)
    1746                     for (j = 0; j < (out->bounds->n) - 1; j++) {
    1747                         if ((out->bounds->data.S32[j] <= in->data.F32[i]) &&
    1748                                 (in->data.F32[i] <= out->bounds->data.S32[j + 1])) {
    1749                             (out->nums->data.S32[j])++;
    1750                         }
     1749                    tmpScalar.data.F32 = in->data.F32[i];
     1750                    tmp = p_psVectorBinDisect(out->bounds,
     1751                                              &tmpScalar);
     1752                    if (tmp == -1) {
     1753                        //                      XXX: Generate warning message
     1754                    } else {
     1755                        (out->nums->data.S32[tmp])++;
    17511756                    }
    17521757                }
Note: See TracChangeset for help on using the changeset viewer.