hsv

Replace values in a dimension of a 2D numpy array, from a map dictionary

Replace values in a dimension of a 2D numpy array, from a map dictionary Question: I need to replace the values of a certain index in all lists inside a list, with a value from a dictionary, which is mapped for a different index of that list. Or, if the first index value of every …

Total answers: 3

How to get HSV and LAB color space?

How to get HSV and LAB color space? Question: I’m using OpenCV with Python. My code is: img_hsv = cv2.cvtColor(image,cv.CV_BGR2HSV) img_lab = cv2.cvtColor(image,cv.CV_BGR2Lab) When I access to a pixel value I’m getting values in RGB space, for example: img_hsv[x][y] = [255,255,255] How can I normalize HSV and LAB color space? HSV = 360ยบ 100% 100% …

Total answers: 1

Finding red color in image using Python & OpenCV

Finding red color in image using Python & OpenCV Question: I am trying to extract red color from an image. I have code that applies threshold to leave only values from specified range: img=cv2.imread(‘img.bmp’) img_hsv=cv2.cvtColor(img, cv2.COLOR_BGR2HSV) lower_red = np.array([0,50,50]) #example value upper_red = np.array([10,255,255]) #example value mask = cv2.inRange(img_hsv, lower_red, upper_red) img_result = cv2.bitwise_and(img, img, …

Total answers: 3

HSV to RGB Color Conversion

HSV to RGB Color Conversion Question: Is there a way to convert HSV color arguments to RGB type color arguments using pygame modules in python? I tried the following code, but it returns ridiculous values. import colorsys test_color = colorsys.hsv_to_rgb(359, 100, 100) print(test_color) and this code returns the following nonsense (100, -9900.0, -9900.0) This obviously …

Total answers: 10

Tracking white color using python opencv

Tracking white color using python opencv Question: I would like to track white color using webcam and python opencv. I already have the code to track blue color. _, frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # define range of blue color in HSV lower_blue = np.array([110,100,100]) upper_blue = np.array([130,255,255]) #How to define this range …

Total answers: 3