I found way to convert RGB to HSV, but still I am unable to find the upper and lower value of color. How to do i calculate that?
I have to take out the pickachu from the image
and this my code till now
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_red = np.array([30,50,50])
upper_red = np.array([255,255,180]) #it is trial and error
mask = cv2.inRange(frame, lower_red, upper_red)
res = cv2.bitwise_and(frame, frame, mask= mask)
cv2.imshow('frame',frame)
cv2.imshow('mask',mask)
cv2.imshow('res',res)
k = cv2.waitKey(5) & 0xFF
if k == 27:
break
cv2.destroyAllWindows()
cap.release()
please help me