Skip to content

Commit fda1e76

Browse files
Feedback.
Still need to remove the descriptions of these flags from cv::norm
1 parent 570083f commit fda1e76

File tree

2 files changed

+52
-6
lines changed

2 files changed

+52
-6
lines changed

modules/core/include/opencv2/core.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,14 @@ Scalar_ 's.
640640
CV_EXPORTS_W void meanStdDev(InputArray src, OutputArray mean, OutputArray stddev,
641641
InputArray mask=noArray());
642642

643-
/** @brief Calculates an absolute array norm.
643+
/** @brief Calculates the absolute norm of an array.
644644
645645
This version of cv::norm calculates the absolute norm of src1. The type of norm to calculate is specified using cv::NormTypes.
646646
647+
If normType is not specified, NORM_L2 is used.
648+
649+
--done edit--
650+
647651
\f[norm = \forkfour{\|\texttt{src1}\|_{L_{\infty}} = \max _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_INF}\) }
648652
{ \| \texttt{src1} \| _{L_1} = \sum _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_L1}\) }
649653
{ \| \texttt{src1} \| _{L_2} = \sqrt{\sum_I \texttt{src1}(I)^2} }{if \(\texttt{normType} = \texttt{NORM_L2}\) }

modules/core/include/opencv2/core/base.hpp

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,58 @@ enum DecompTypes {
151151
DECOMP_NORMAL = 16
152152
};
153153

154-
//! norm types
155-
enum NormTypes { NORM_INF = 1,
154+
/** norm types
155+
156+
src1 and src2 denote input arrays.
157+
*/
158+
159+
enum NormTypes {
160+
/**
161+
\f[
162+
norm = \forkthree
163+
{\|\texttt{src1}\|_{L_{\infty}} = \max _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_INF}\) }
164+
{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} = \max _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM_INF}\) }
165+
{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} }{\|\texttt{src2}\|_{L_{\infty}} }}{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_INF}\) }
166+
\f]
167+
*/
168+
NORM_INF = 1,
169+
/**
170+
\f[
171+
norm = \forkthree
172+
{\| \texttt{src1} \| _{L_1} = \sum _I | \texttt{src1} (I)|}{if \(\texttt{normType} = \texttt{NORM_L1}\)}
173+
{ \| \texttt{src1} - \texttt{src2} \| _{L_1} = \sum _I | \texttt{src1} (I) - \texttt{src2} (I)|}{if \(\texttt{normType} = \texttt{NORM_L1}\) }
174+
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L1}\) }
175+
\f]*/
156176
NORM_L1 = 2,
177+
/**
178+
\f[
179+
norm = \forkthree
180+
{ \| \texttt{src1} \| _{L_2} = \sqrt{\sum_I \texttt{src1}(I)^2} }{if \(\texttt{normType} = \texttt{NORM_L2}\) }
181+
{ \| \texttt{src1} - \texttt{src2} \| _{L_2} = \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if \(\texttt{normType} = \texttt{NORM_L2}\) }
182+
{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L2}\) }
183+
\f]
184+
*/
157185
NORM_L2 = 4,
186+
/**
187+
\f[
188+
norm = \forkthree
189+
{ \| \texttt{src1} \| _{L_2} ^{2} = \sum_I \texttt{src1}(I)^2} {if \(\texttt{normType} = \texttt{NORM_L2SQR}\)}
190+
{ \| \texttt{src1} - \texttt{src2} \| _{L_2} ^{2} = \sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2 }{if \(\texttt{normType} = \texttt{NORM_L2SQR}\) }
191+
{ \left(\frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}}\right)^2 }{if \(\texttt{normType} = \texttt{NORM_RELATIVE | NORM_L2}\) }
192+
\f]
193+
*/
158194
NORM_L2SQR = 5,
195+
/**
196+
In the case of one input array, calculates the Hamming distance of the array from zero,
197+
In the case of two input arrays, calculates the Hamming distance between the arrays.
198+
*/
159199
NORM_HAMMING = 6,
200+
/**
201+
Similar to NORM_HAMMING, but in the calculation, each two bits of the input sequence will
202+
be added and treated as a single bit to be used in the same calculation as NORM_HAMMING.
203+
*/
160204
NORM_HAMMING2 = 7,
161-
#ifndef CV_DOXYGEN
162-
NORM_TYPE_MASK = 7,
163-
#endif
205+
NORM_TYPE_MASK = 7, //!< bit-mask which can be used to separate norm type from norm flags
164206
NORM_RELATIVE = 8, //!< flag
165207
NORM_MINMAX = 32 //!< flag
166208
};

0 commit comments

Comments
 (0)