x+w
and y+h
only the problem is that when I do x+w/2
and y+h/2
the following error appears: integer argument expected, got float
. HELP ME !!
Code:
import cv2
import numpy as np
cap = cv2.cv2.VideoCapture(0)
kernel = np.ones((5,5), np.uint8)
while True:
ret, frame = cap.read()
rangomax = np.array([50,255,50])
rangomin = np.array([0, 51, 0])
mascara = cv2.cv2.inRange(frame, rangomin, rangomax)
opening = cv2.cv2.morphologyEx(mascara, cv2.cv2.MORPH_OPEN, kernel)
x,y,w,h = cv2.cv2.boundingRect(opening)
cv2.cv2.rectangle(frame, (x,y), (x+w, y+h), (0,255,0), 3)
cv2.cv2.circle(frame,(x+w/2, y+h/2), 5,(0,0,255), -1)
cv2.cv2.imshow('video', frame)
k = cv2.cv2.waitKey(1) & 0xFF
if k == 27:
break
cap.release()