Hello,
Thank you for your help, but so far, it is still not working.
Here below is how I removed the sync part (maybe it's wrong), but I don't have error, just nothing from the camera. Can it be because I am using a USB2 (USB3 for camera to USB2 for my computer) ?
with dai.Device() as device:
stereo = 1 < len(device.getConnectedCameras())
device.startPipeline(create_pipeline(stereo))
queues = {}
# Create output queues
for name in ["color", "detection", "recognition"]:
queues[name] = device.getOutputQueue(name)
while True:
for name, q in queues.items():
if q.has():
frame = None
detections = None
recognitions = None
if name == "color":
frame = q.get().getCvFrame()
elif name == "detection":
detections = q.get().detections
elif name == "recognition":
recognitions = q.get()
if detections is not None:
for detection in detections:
bbox = frame_norm(frame, (detection.xmin, detection.ymin, detection.xmax, detection.ymax))
cv2.rectangle(frame, (bbox[0], bbox[1]), (bbox[2], bbox[3]), (10, 245, 10), 2)
cv2.putText(frame, "Age: {}, Gender: {}".format(age, gender_str), (bbox[0], bbox[1] + 30), cv2.FONT_HERSHEY_TRIPLEX, 1.5, (0, 0, 0), 8)
cv2.putText(frame, "Age: {}, Gender: {}".format(age, gender_str), (bbox[0], bbox[1] + 30), cv2.FONT_HERSHEY_TRIPLEX, 1.5, (255, 255, 255), 2)
cv2.imshow("Camera", frame)
elif recognitions is not None:
rec = recognitions.getFirstLayerFp16()
index = np.argmax(rec, axis=1)
text = "No Detection"
color = (0,0,255) # Red
if index is not None:
text = index
color = (0,255,0)
cv2.putText(frame, text, (10, 50), cv2.FONT_HERSHEY_TRIPLEX, 1.5, color, 2)