height, width, channels = frame.shape
font = cv2.FONT_HERSHEY_SIMPLEX colors = np.random.uniform(0, 255, size=(len(classes), 3)) for i in range(len(boxes)): if i in indexes: x, y, w, h = boxes[i] label = str(classes[class_ids[i]]) confidence = str(round(confidences[i], 2)) color = colors[i] cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2) cv2.putText(frame, label + " " + confidence, (x, y + 20), font, 2, color, 2) random_anna.mp4
# Detecting objects blob = cv2.dnn.blobFromImage(frame, 0.00392, (416, 416), (0, 0, 0), True, crop=False) net.setInput(blob) outs = net.forward(output_layers) height, width, channels = frame
indexes = cv2.dnn.NMSBoxes(boxes, confidences, 0.5, 0.4) 2)) color = colors[i] cv2.rectangle(frame
video = cv2.VideoCapture('random_anna.mp4')