From b08d67c4e15ff44d1d875aab99da272ff1ce2a30 Mon Sep 17 00:00:00 2001 From: Liangda-w <66914151+Liangda-w@users.noreply.github.com> Date: Mon, 1 Feb 2021 10:17:54 +0100 Subject: [PATCH] Merge pull request #19419 from Liangda-w:patch-1 * Fix error in documentation for RGB->HSV convertion * Update colors.markdown --- modules/imgproc/doc/colors.markdown | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/imgproc/doc/colors.markdown b/modules/imgproc/doc/colors.markdown index f1023621ad..47d97a7263 100644 --- a/modules/imgproc/doc/colors.markdown +++ b/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$ .