Skip to content

Commit e77a5d5

Browse files
committed
Merge pull request opencv#8422 from berak:fix_shapematchmodes
2 parents c1007c7 + 11f3c07 commit e77a5d5

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

modules/imgproc/include/opencv2/imgproc.hpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,20 @@ enum ContourApproximationModes {
452452
CHAIN_APPROX_TC89_KCOS = 4
453453
};
454454

455+
/** @brief Shape matching methods
456+
457+
\f$A\f$ denotes object1,\f$B\f$ denotes object2
458+
459+
\f$\begin{array}{l} m^A_i = \mathrm{sign} (h^A_i) \cdot \log{h^A_i} \\ m^B_i = \mathrm{sign} (h^B_i) \cdot \log{h^B_i} \end{array}\f$
460+
461+
and \f$h^A_i, h^B_i\f$ are the Hu moments of \f$A\f$ and \f$B\f$ , respectively.
462+
*/
463+
enum ShapeMatchModes {
464+
CONTOURS_MATCH_I1 =1, //!< \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f]
465+
CONTOURS_MATCH_I2 =2, //!< \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f]
466+
CONTOURS_MATCH_I3 =3 //!< \f[I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f]
467+
};
468+
455469
//! @} imgproc_shape
456470

457471
//! Variants of a Hough transform
@@ -3915,7 +3929,7 @@ The function compares two shapes. All three implemented methods use the Hu invar
39153929
39163930
@param contour1 First contour or grayscale image.
39173931
@param contour2 Second contour or grayscale image.
3918-
@param method Comparison method, see ::ShapeMatchModes
3932+
@param method Comparison method, see cv::ShapeMatchModes
39193933
@param parameter Method-specific parameter (not supported now).
39203934
*/
39213935
CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,

modules/imgproc/include/opencv2/imgproc/types_c.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -501,15 +501,8 @@ enum
501501
CV_POLY_APPROX_DP = 0
502502
};
503503

504-
/** @brief Shape matching methods
505-
506-
\f$A\f$ denotes object1,\f$B\f$ denotes object2
507-
508-
\f$\begin{array}{l} m^A_i = \mathrm{sign} (h^A_i) \cdot \log{h^A_i} \\ m^B_i = \mathrm{sign} (h^B_i) \cdot \log{h^B_i} \end{array}\f$
509-
510-
and \f$h^A_i, h^B_i\f$ are the Hu moments of \f$A\f$ and \f$B\f$ , respectively.
511-
*/
512-
enum ShapeMatchModes
504+
/** Shape matching methods */
505+
enum
513506
{
514507
CV_CONTOURS_MATCH_I1 =1, //!< \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f]
515508
CV_CONTOURS_MATCH_I2 =2, //!< \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f]

0 commit comments

Comments
 (0)