MATLAB File Help: cv.matchShapes | Index |
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:
I1(A,B) = \sum{i=1,...,7} | 1/mi^A - 1/mi^B |
I2:
I2(A,B) = \sum{i=1,...,7} | mi^A - mi^B |
I3:
I3(A,B) = \max{i=1,...,7} | mi^A - mi^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.