cv.matchShapes - MATLAB File Help |
Compares two shapes
result = cv.matchShapes(contour1, contour2)
result = cv.matchShapes(..., 'OptionName', optionValue, ...)
int32
or single
type) of the form
{[x,y], ...}
. In case of image, a single-channel 8-bit or floating-point
2D matrix.The function compares two shapes. All three implemented methods use the Hu invariants (see cv.HuMoments).
The following shape matching methods are available:
I1:
I_1(A,B) = sum_{i=1,...,7} | 1/m_i^A - 1/m_i^B |
I2:
I_2(A,B) = sum_{i=1,...,7} | m_i^A - m_i^B |
I3:
I_3(A,B) = max_{i=1,...,7} | m_i^A - m_i^B | / | m_i^A |
where A
denotes contour1
, B
denotes contour2
, and:
m_i^A = sign(h_i^A) * log(h_i^A)
m_i^B = sign(h_i^B) * log(h_i^B)
and h_i^A
, h_i^B
are the Hu moments of A
and B
, respectively.