read image as HSV vs convert red RBG to HSV?
Hi
Why is the final result of both different?
Reading the image as HSV
OR converting a color image into HSV
then,
Extracting the pixels using HSV values
should give SAME RESULT
Here's the code for reading image as HSV
then selecting HSV value
cim = cv2.imread('OI5.jpg',cv2.COLOR_RGB2HSV)
huemask1 = ((cim >np.array([100,0,0])).astype(np.float32)+(cim>np.array([100,0,0])).astype(np.float32)*(-0.5)+0.5)
mask1_intrd = (huemask1.astype(np.uint8))*255
Here's the OUTPUT
Here's the code for reading image as color, convert to HSV
the selecting by HSV Value
cim = cv2.imread('OI5.jpg')
hsvim = cv2.cvtColor(cim,cv2.COLOR_RGB2HSV)
huemask1 = ((hsvim >np.array([100,0,0])).astype(np.float32)+(hsvim>np.array([100,0,0])).astype(np.float32)*(-0.5)+0.5)
mask1_intrd = (huemask1.astype(np.uint8))*255
Here's the OUTPUT
Shouldn't the 2nd parameter of cv2.imread() be cv2.BGR2HSV?...