In order to convert a BGR image to HSV image pass cv2.COLOR_BGR2HSV flag to the cv2.cvtColor() function.
import cv2 img = cv2.imread('/home/mohit/cardiff.jpg') if img is None: print('Image is not present.') else: img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) cv2.imshow(img) cv2.destroyAllWindows() cv2.waitKey(0)
Output
Original Image