Complete the code to load an image using OpenCV.
import cv2 image = cv2.[1]('image.jpg')
The imread function loads an image from a file into memory.
Complete the code to draw a rectangle around the detected object.
cv2.rectangle(image, (x, y), (x + w, y + h), [1], 2)
The color (0, 255, 0) represents green in BGR format, commonly used to highlight detected objects.
Fix the error in the code to correctly extract the bounding box coordinates.
x, y, w, h = [1]The bounding box coordinates are stored under the key 'bbox' in the detection result dictionary.
Fill both blanks to create a dictionary of object labels and their confidence scores.
results = {det['[1]']: det['[2]'] for det in detections}The dictionary maps each detected object's label to its score, representing confidence.
Fill all three blanks to filter detections with confidence above 0.5 and create a list of bounding boxes.
filtered_boxes = [det['[1]'] for det in detections if det['[2]'] [3] 0.5]
This code selects bounding boxes where the detection score is greater than 0.5, meaning confident detections.