Я получил эту ошибку в cv2.circle...
Код: Выделить всё
Traceback (most recent call last):
File "C:/Users/Arne/PycharmProjects/JARVISv2/Virtual.py", line 65, in
cv2.circle(img, (cx, cy), (w + h) / 4, (0, 0, 255), 2)
TypeError: integer argument expected, got float
[ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (674)
SourceReaderCB::~SourceReaderCB terminating async callback
Process finished with exit code 1
ЗАРАНЕЕ СПАСИБО
Вот мой код --
Код: Выделить всё
if (len(conts) == 2):
if (pinchFlag == 1):
pinchFlag = 0
mouse.release(Button.left)
x1, y1, w1, h1 = cv2.boundingRect(conts[0])
x2, y2, w2, h2 = cv2.boundingRect(conts[1])
cv2.rectangle(img, (x1, y1), (x1 + w1, y1 + h1), (255, 0, 0), 2)
cv2.rectangle(img, (x2, y2), (x2 + w2, y2 + h2), (255, 0, 0), 2)
cx1 = int(x1 + w1 // 2
cy1 = int(y1 + h1 // 2
)
cx2 = int (x2 + w2 // 2
)
cy2 = int(y2 + h2 // 2
)
cx = (cx1 + cx2) / 2
cy = (cy1 + cy2) / 2
cv2.line(img, (cx1, cy1), (cx2, cy2), (255, 0, 0), 2)
cv2.circle(img, (cx, cy), 2, (0, 0, 255), 2)
mouseLoc = (sx - (cx * sx / camx), cy * sy / camy)
mouse.position = mouseLoc
while mouse.position != mouseLoc:
пройти
Подробнее здесь: https://stackoverflow.com/questions/616 ... ncv-circle
Мобильная версия