Merge pull request #19419 from Liangda-w:patch-1

* Fix error in documentation for RGB->HSV convertion

* Update colors.markdown
pull/19443/head
Liangda-w 4 years ago committed by GitHub
parent 5ab4623c2a
commit b08d67c4e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      modules/imgproc/doc/colors.markdown

@ -56,7 +56,10 @@ scaled to fit the 0 to 1 range.
\f[V \leftarrow max(R,G,B)\f]
\f[S \leftarrow \fork{\frac{V-min(R,G,B)}{V}}{if \(V \neq 0\)}{0}{otherwise}\f]
\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]
\f[H \leftarrow \forkfour{{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\)}
{0}{if \(R=G=B\)}\f]
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$,
\f$0 \leq H \leq 360\f$ .
@ -78,9 +81,10 @@ scaled to fit the 0 to 1 range.
\f[L \leftarrow \frac{V_{max} + V_{min}}{2}\f]
\f[S \leftarrow \fork { \frac{V_{max} - V_{min}}{V_{max} + V_{min}} }{if \(L < 0.5\) }
{ \frac{V_{max} - V_{min}}{2 - (V_{max} + V_{min})} }{if \(L \ge 0.5\) }\f]
\f[H \leftarrow \forkthree {{60(G - B)}/{(V_{max}-V_{min})}}{if \(V_{max}=R\) }
\f[H \leftarrow \forkfour {{60(G - B)}/{(V_{max}-V_{min})}}{if \(V_{max}=R\) }
{{120+60(B - R)}/{(V_{max}-V_{min})}}{if \(V_{max}=G\) }
{{240+60(R - G)}/{(V_{max}-V_{min})}}{if \(V_{max}=B\) }\f]
{{240+60(R - G)}/{(V_{max}-V_{min})}}{if \(V_{max}=B\) }
{0}{if \(R=G=B\) }\f]
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
1\f$, \f$0 \leq H \leq 360\f$ .

Loading…
Cancel
Save