I'm trying to convert an image from RGB to HSV color space, here's a segment of my code:
import cv2
import numpy as np
import imutils
lower = np.array([0, 48, 80], dtype= "uint8")
upper = np.array([20, 255, 255], dtype= "uint8")
img = cv2.imread('3.JPG', 0)
img = imutils.resize(img, width = 400)
cv2.waitKey(1)
converted = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
new_skinMask = cv2.inRange(converted, lower, upper)
but I'm getting an error on:
converted = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
the error is:
OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cv::cvtColor
can anybody help me with this?