Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the trick here is to convert your image to float, before the HSV conversion:

ocv = np.float32(ocv)
hsv = cv2.cvtColor(ocv, cv2.COLOR_BGR2HSV_FULL)

# check results:
t = cv2.minMaxLoc(hsv[:,:,0])
print(t,im.dtype)

((0.0, 358.7050476074219, (0, 0), (54, 33)), dtype('float32'))

(for the opencv logo above. you can see, -- max hue is ~360, as expected ;)

the trick here is to convert your image to float, before the HSV conversion:

ocv = np.float32(ocv)
hsv = cv2.cvtColor(ocv, cv2.COLOR_BGR2HSV_FULL)

# check results:
t mm = cv2.minMaxLoc(hsv[:,:,0])
print(t,im.dtype)
print(mm, im.dtype)

((0.0, 358.7050476074219, (0, 0), (54, 33)), dtype('float32'))

(for the opencv logo above. you can see, -- max hue is ~360, as expected ;)

the trick here is to convert your image to float, float32 (float64 is not supported), before the HSV conversion:

ocv = np.float32(ocv)
hsv = cv2.cvtColor(ocv, cv2.COLOR_BGR2HSV_FULL)

# check results:
mm = cv2.minMaxLoc(hsv[:,:,0])
print(mm, im.dtype)

((0.0, 358.7050476074219, (0, 0), (54, 33)), dtype('float32'))

(for the opencv logo above. you can see, -- max hue is ~360, as expected ;)