Formula for compactness measurement


What is the mathematical formula for measuring compactness in MeasureObjectSizeShape? I’m assuming its somewhere in the source code but couldn’t find where?


Hi Scott,

The formula for compactness is: 2 * pi * (a + c) / m_00 where a = m_20 / m_00, c = m_02 / m_00 and m_pq is the two-dimensional(p+q)th order moments in which m_pq = sum(x^p * y^g)which is a double-integral summation over all the pixels x in the object.
The reference to this formula can be found in in the cpmath folder.