hsvImg = cv2.cvtColor(MyImage,cv2.COLOR_BGR2HSV) code example Example: opencv python rgb to hsv colorsys.rgb_to_hsv(px[2], px[1], px[0})