I'm trying to detect object by color, and get some "information" about the object - like size and position. So far I just did this
import cv2
import numpy
vd1 = cv2.VideoCapture(0)
while True:
ret, frame = vd1.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_blue = numpy.array([110, 50, 50])
upper_blue = numpy.array([130, 255, 255])
mask = cv2.inRange(hsv, lower_blue, upper_blue)
res = cv2.bitwise_and(frame, frame, mask= mask)
cv2.imshow("frame", frame)
cv2.imshow("mask", mask)
cv2.imshow("res", res)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
vd1.release()
so I see just the blue objects, but I don't know how I can refer to them like an objects. (so I can get information about the object, or changing the pixels - for example)
How can I do this ? Thanks in advance