Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv2.COLOR_RGB2HSV is not giving correct HSV values

Hi, I ran a very simple code as below to convert RGB to HSV, but opencv is giving me incorrect answers. I want to convert yellow from RGB [255,255,0] to HSV, which should give me a value of [60,100,100] or [60,255,255]. However, it is giving me [30,255,255]. Later I tried to use cv2.COLOR_BRG2HSV, it is giving me [90,255,255]. None of these is the correct answer, why?? I'm using macOS Mojave (10.14), Anaconda 1.9.2, python 3.6.4, opencv 3.4.1.

Code:

import numpy as np

import cv2

a = [255,255,0]

HSV_convert = cv2.cvtColor(np.uint8([[a]]), cv2.COLOR_BGR2HSV)

print(HSV_convert) image description image description

click to hide/show revision 2
None

updated 2018-11-17 20:43:44 -0600

berak gravatar image

cv2.COLOR_RGB2HSV is not giving correct HSV values

Hi, I ran a very simple code as below to convert RGB to HSV, but opencv is giving me incorrect answers. I want to convert yellow from RGB [255,255,0] to HSV, which should give me a value of [60,100,100] or [60,255,255]. However, it is giving me [30,255,255]. Later I tried to use cv2.COLOR_BRG2HSV, it is giving me [90,255,255]. None of these is the correct answer, why?? I'm using macOS Mojave (10.14), Anaconda 1.9.2, python 3.6.4, opencv 3.4.1.

Code:

import numpy as np

import cv2

a = [255,255,0]

HSV_convert = cv2.cvtColor(np.uint8([[a]]), cv2.COLOR_BGR2HSV)

print(HSV_convert) image description image descriptionprint(HSV_convert)

cv2.COLOR_RGB2HSV is not giving correct HSV values

Hi, I ran a very simple code as below to convert RGB to HSV, but opencv is giving me incorrect answers. I want to convert yellow from RGB [255,255,0] to HSV, which should give me a value of [60,100,100] or [60,255,255]. However, it is giving me [30,255,255]. Later I tried to use cv2.COLOR_BRG2HSV, it is giving me [90,255,255]. None of these is the correct answer, why?? I'm using macOS Mojave (10.14), Anaconda 1.9.2, python 3.6.4, opencv 3.4.1.

Code:

import numpy as np

import cv2

a = [255,255,0]

HSV_convert = cv2.cvtColor(np.uint8([[a]]), cv2.COLOR_BGR2HSV)

print(HSV_convert)

cv2.COLOR_RGB2HSV is not giving correct HSV values

Hi, I ran a very simple code as below to convert RGB to HSV, but opencv is giving me incorrect answers. I want to convert yellow from RGB [255,255,0] to HSV, which should give me a value of [60,100,100] or [60,255,255]. However, it is giving me [30,255,255]. Later I tried to use cv2.COLOR_BRG2HSV, it is giving me [90,255,255]. None of these is the correct answer, why?? I'm using macOS Mojave (10.14), Anaconda 1.9.2, python 3.6.4, opencv 3.4.1.

Code:

import numpy as np

import cv2

a = [255,255,0]

HSV_convert = cv2.cvtColor(np.uint8([[a]]), cv2.COLOR_BGR2HSV)

print(HSV_convert)

cv2.COLOR_RGB2HSV is not giving correct HSV values

Hi, I ran a very simple code as below to convert RGB to HSV, but opencv is giving me incorrect answers. I want to convert yellow from RGB [255,255,0] to HSV, which should give me a value of [60,100,100] or [60,255,255]. However, it is giving me [30,255,255]. Later I tried to use cv2.COLOR_BRG2HSV, it is giving me [90,255,255]. None of these is the correct answer, why?? I'm using macOS Mojave (10.14), Anaconda 1.9.2, python 3.6.4, opencv 3.4.1.

Code:

import numpy as np

import cv2

a = [255,255,0]

HSV_convert = cv2.cvtColor(np.uint8([[a]]), cv2.COLOR_BGR2HSV)

print(HSV_convert)