I see the tutorial for a different camera but how would it be adapted for the Oak D SR camera? For setting the cameras, the depth map alignment, etc.
Oak D SR yolo v8 spatial detection network
When I use the modified links, I get an error that says "Specified camera board socket already used." I suspect this is due to the same CAM_B being linked to multiple things. Am I understanding this right? How can I fix this?
erik Aha, thanks.
[19443010B17B772700] [1.5.2] [2.814] [StereoDepth(3)] [error] Left input image stride ('900') should be equal to its width ('300'). Skipping frame!
What does this error mean? Is this referring to the stride of the model or is it fps related?
I do set the output size correctly for stereo, so I'm a bit confused.
pipeline = dai.Pipeline()
spatialDetectionNetwork = pipeline.create(dai.node.YoloSpatialDetectionNetwork)
colorLeft = pipeline.create(dai.node.ColorCamera)
colorRight = pipeline.create(dai.node.ColorCamera)
stereo = pipeline.create(dai.node.StereoDepth)
xoutRgb = pipeline.create(dai.node.XLinkOut)
nnOut = pipeline.create(dai.node.XLinkOut)
xoutBoundingBoxDepthMapping = pipeline.create(dai.node.XLinkOut)
xoutDepth = pipeline.create(dai.node.XLinkOut)
xoutRgb.setStreamName("rgb")
nnOut.setStreamName("nn")
xoutBoundingBoxDepthMapping.setStreamName("boundingBoxDepthMapping")
xoutDepth.setStreamName("depth")
colorLeft.setPreviewSize(640,640)
colorRight.setPreviewSize(640,640)
colorLeft.setBoardSocket(dai.CameraBoardSocket.CAM_B)
colorRight.setBoardSocket(dai.CameraBoardSocket.CAM_C)
colorLeft.setResolution(dai.ColorCameraProperties.SensorResolution.THE_800_P)
colorLeft.setVideoSize(W, H)
colorLeft.setFps(30)
colorRight.setResolution(dai.ColorCameraProperties.SensorResolution.THE_800_P)
colorRight.setVideoSize(W, H)
colorRight.setFps(30)
stereo.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY)
stereo.setDepthAlign(dai.CameraBoardSocket.CAM_B)
stereo.setOutputSize(W, H)
stereo.setLeftRightCheck(True)
stereo.setSubpixel(True)
spatialDetectionNetwork.setBlobPath(nnPath)
spatialDetectionNetwork.setConfidenceThreshold(confidenceThreshold)
spatialDetectionNetwork.setNumClasses(classes)
spatialDetectionNetwork.setCoordinateSize(coordinates)
spatialDetectionNetwork.setAnchors(anchors)
spatialDetectionNetwork.setAnchorMasks(anchorMasks)
spatialDetectionNetwork.setIouThreshold(iouThreshold)
spatialDetectionNetwork.setNumInferenceThreads(2)
spatialDetectionNetwork.input.setBlocking(False)
colorLeft.video.link(stereo.left)
colorRight.video.link(stereo.right)
spatialDetectionNetwork.passthrough.link(xoutRgb.input)
spatialDetectionNetwork.out.link(nnOut.input)
spatialDetectionNetwork.boundingBoxMapping.link(xoutBoundingBoxDepthMapping.input)
stereo.depth.link(spatialDetectionNetwork.inputDepth)
spatialDetectionNetwork.passthroughDepth.link(xoutDepth.input)
erik Sorry, sent the wrong version. This one's I've checked to make sure that it gets the error I wish to address. The output queues return None so when I try to access it, ie. "frame = inRgb.getCvFrame()", it throws an error--I suspect it's a mistake in the way the pipeline was set up with the cameras.
@yjenkim tryGet() will return None if there's no message in queue. CHange to .get()
which will block until a message is received, and it should work (wont throw the same error).
while True:
print("Getting frame")
inRgb = qRgb.get()
print("Got qRgb frame")
# print(inRgb)
inDet = qDet.get()
print("Got qDet frame")
# print(inDet)
depth = depthQueue.get()
print("Got depthQueue frame")
@yjenkim please check out:
https://docs.luxonis.com/hardware/platform/depth/configuring-stereo-depth/
Especially short-range depth perception.