Skip to content

Commit b08d67c

Browse files
authored
Merge pull request opencv#19419 from Liangda-w:patch-1
* Fix error in documentation for RGB->HSV convertion * Update colors.markdown
1 parent 5ab4623 commit b08d67c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/imgproc/doc/colors.markdown

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ scaled to fit the 0 to 1 range.
5656

5757
\f[V \leftarrow max(R,G,B)\f]
5858
\f[S \leftarrow \fork{\frac{V-min(R,G,B)}{V}}{if \(V \neq 0\)}{0}{otherwise}\f]
59-
\f[H \leftarrow \forkthree{{60(G - B)}/{(V-min(R,G,B))}}{if \(V=R\)}{{120+60(B - R)}/{(V-min(R,G,B))}}{if \(V=G\)}{{240+60(R - G)}/{(V-min(R,G,B))}}{if \(V=B\)}\f]
59+
\f[H \leftarrow \forkfour{{60(G - B)}/{(V-min(R,G,B))}}{if \(V=R\)}
60+
{{120+60(B - R)}/{(V-min(R,G,B))}}{if \(V=G\)}
61+
{{240+60(R - G)}/{(V-min(R,G,B))}}{if \(V=B\)}
62+
{0}{if \(R=G=B\)}\f]
6063
If \f$H<0\f$ then \f$H \leftarrow H+360\f$ . On output \f$0 \leq V \leq 1\f$, \f$0 \leq S \leq 1\f$,
6164
\f$0 \leq H \leq 360\f$ .
6265

@@ -78,9 +81,10 @@ scaled to fit the 0 to 1 range.
7881
\f[L \leftarrow \frac{V_{max} + V_{min}}{2}\f]
7982
\f[S \leftarrow \fork { \frac{V_{max} - V_{min}}{V_{max} + V_{min}} }{if \(L < 0.5\) }
8083
{ \frac{V_{max} - V_{min}}{2 - (V_{max} + V_{min})} }{if \(L \ge 0.5\) }\f]
81-
\f[H \leftarrow \forkthree {{60(G - B)}/{(V_{max}-V_{min})}}{if \(V_{max}=R\) }
84+
\f[H \leftarrow \forkfour {{60(G - B)}/{(V_{max}-V_{min})}}{if \(V_{max}=R\) }
8285
{{120+60(B - R)}/{(V_{max}-V_{min})}}{if \(V_{max}=G\) }
83-
{{240+60(R - G)}/{(V_{max}-V_{min})}}{if \(V_{max}=B\) }\f]
86+
{{240+60(R - G)}/{(V_{max}-V_{min})}}{if \(V_{max}=B\) }
87+
{0}{if \(R=G=B\) }\f]
8488
If \f$H<0\f$ then \f$H \leftarrow H+360\f$ . On output \f$0 \leq L \leq 1\f$, \f$0 \leq S \leq
8589
1\f$, \f$0 \leq H \leq 360\f$ .
8690

0 commit comments

Comments
 (0)