import numpy
import cv2
import time
coco='F:/coco.names'
configPath='F:/yolo.cfg'
weightPath='F:/yolov3.weights'
CONFIDENCE = 0.2
THRESHOLD = 0.4
net = cv2.dnn.readNetFromDarknet(configPath, weightPath)
clicked = False
def onMouse(event, x, y, flags, param):
global clicked
if event == cv2.EVENT_LBUTTONUP:
clicked = True
cameraCapture = cv2.VideoCapture(0)
cv2.namedWindow('img')
cv2.setMouseCallback('img', onMouse)
success, frame = cameraCapture.read()
while success and cv2.waitKey(1) == -1 and not clicked:
blobImg = cv2.dnn.blobFromImage(frame, 1.0 / 255.0