Changeset 1823 for trunk/psLib/src/math/psStats.c
- Timestamp:
- Sep 16, 2004, 4:14:52 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psStats.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psStats.c
r1722 r1823 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.5 4$ $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 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1449 1449 void p_ps_FitTheGaussian() 1450 1450 { 1451 1452 1451 // Fit a Gaussian to the bins in the range MODE-dL to Mode+dL 1453 1452 // NOTE: This code uses the psMinimize.c functions to perform … … 1455 1454 // I am commenting this code out, and replacing it with code which 1456 1455 // calculates the mean directly on the robustHistogram. 1456 // 1457 // XXX: Replace this with the LaGrange interpolation stuff. 1457 1458 1458 1459 domain = psImageAlloc(1, robustHistogramVector->n, PS_TYPE_F32); … … 1671 1672 psHistogram* psVectorHistogram(psHistogram* out, 1672 1673 const psVector* restrict in, 1673 const psVector* restrict mask, unsigned int maskVal) 1674 const psVector* restrict mask, 1675 unsigned int maskVal) 1674 1676 { 1675 1677 int i = 0; // Loop index variable 1676 int j = 0; // Loop index variable1677 1678 float binSize = 0.0; // Histogram bin size 1678 1679 int binNum = 0; // A temporary bin number 1679 1680 int numBins = 0; // The total number of bins 1681 int tmp = 0; 1682 psScalar tmpScalar; 1683 tmpScalar.type.type = PS_TYPE_F32; 1680 1684 1681 1685 // NOTE: Verify that this is the correct action. … … 1708 1712 } 1709 1713 } 1714 1710 1715 // NOTE: determine the correct action for a variety of other cases: 1711 1716 // in vector has 0 elements, and histogram structure has zero bins. … … 1742 1747 // bin number requires a bit more work. 1743 1748 } else { 1744 // NOTE: This is slow. Put a smarter algorithm here to1745 // 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])++; 1751 1756 } 1752 1757 }
Note:
See TracChangeset
for help on using the changeset viewer.
