|
A structure for accumulating coordinates and computing statistics thereof: area, centroid, horizontality, verticality, variance and elongation. More...
#include <SegmentStatisticsProber.h>
Public Member Functions | |
virtual void | clear () |
Resets the statistics. | |
virtual void | add (const int &i, const int &j) |
Accumulate location (i,j) in the statistics. | |
double | getSize () const |
Returns the size of the segment. More... | |
double | getMeanX () const |
Returns the horizontal coordinate of centre of mass. More... | |
double | getMeanY () const |
Returns the horizontal coordinate of centre of mass. More... | |
double | getHorizontality () const |
Returns the horizontal variance $\sigma_x$ scaled with total variance $\sigma_x + \sigma_y$. Takes values in [0,1]. More... | |
double | getVerticality () const |
Returns the vertical variance scaled with total variance. Takes values in [0,1]. | |
double | getVariance () const |
Returns the total variance of the pixel coordinates. More... | |
double | getVarianceHorz () const |
double | getVarianceVert () const |
double | getSlimness () const |
Returns the proportion in which the variance equals the variance of an annulus. More... | |
double | getElongation () const |
Returns the proportion in which the variance equals the variance of an annulus. More... | |
double | getEigenValue1 () const |
double | getEigenValue2 () const |
void | toOstr (std::ostream &ostr) const |
Protected Member Functions | |
void | updateStats () const |
Protected Attributes | |
bool | _updateNeeded |
long int | size |
Size of segment (area). | |
long | sumX |
Sum of coordinates. | |
long | sumY |
long | sumXX |
Sum of squared coordinates. | |
long | sumYY |
long | sumXY |
double | sizeD |
Size in double precision. | |
double | cx |
Center of mass, x coordinate. | |
double | cy |
Center of mass, y coordinate. | |
double | cxx |
Elements of covariance matrix. | |
double | cyy |
double | cxy |
double | eigenValue1 |
double | eigenVector1x |
double | eigenVector1y |
double | eigenValue2 |
double | eigenVector2x |
double | eigenVector2y |
double | elongation |
A structure for accumulating coordinates and computing statistics thereof: area, centroid, horizontality, verticality, variance and elongation.
This class is applied by SegmentStatisticProber which implements the recursive traversal through a segment.
All the statistics are based only on locations (i,j), not on intensities.
|
inline |
Returns the proportion in which the variance equals the variance of an annulus.
Returns getSlimness() * (1 - getElongation()). Returns the principal access ratio (e1-e2)/(e1+e2).
1-e2/e1 = e1-e2 / e1
|
inline |
Returns the horizontal variance $\sigma_x$ scaled with total variance $\sigma_x + \sigma_y$. Takes values in [0,1].
Size [ m_x = \frac{\sqrt{}}{N} ]
|
inline |
Returns the horizontal coordinate of centre of mass.
Size [ m_x = \frac{1}{N}\sum_{i=1}^N x_i ]
|
inline |
Returns the horizontal coordinate of centre of mass.
Size [ m_x = \frac{1}{N}\sum_{i=1}^N x_i ]
|
inline |
Returns the size of the segment.
Size [ s = ]
|
inline |
Returns the proportion in which the variance equals the variance of an annulus.
The variance returned by getVariance() is defined as
where is the distance from centroid .
For an annulus, with inner radius and outer radius , the area is
and the variance
Hence, for circular areas the variance varies between (for circle) and (for infinitesimally thin annulus). Obviously, these are the lower and upper limits of variance also for segments of any shape (consider a set of points, starting from two).
However, thin line segments achieve values close to those of annula. Consider a thing rectangle of "radius" , ie height :
(Under construction.)
If a segment is circular, its radius squared is , where is the area returned by getSize(). Hence, given a segment of size the variance lies between and . The annularity is the variance normalized to these limits:
|
inline |
Returns the total variance of the pixel coordinates.
Returns the squared mean radius from the centroid. In physics, moment of inertia corresponds to this quantity, assuming that the body has constant density.
|
inlineprotected |
Near undetectValue