Hi erik
When trying to visualize the depth, we got :
[14442C1081F4D5D600] [9.1] [18.519] [StereoDepth(8)] [error] There is no available extrinsic calibration between camera ID: '1' and '2'
Does it mean that calibration file is missing?
Other developer got different error with the custom script :
$ python3 ex1_c2.py
Reading calib data
...done
Check that everything is nice and cool
Setup done. Some checks first
Traceback (most recent call last):
File "/home/tmatila/tommi/DepthAI/ex1_c2.py", line 80, in <module>
with dai.Device(pipeline) as device:
RuntimeError: StereoDepth(4) - StereoDepth | Invalid resolution: Width 1920, Height 1200
The script :
import depthai as dai
import cv2
import numpy as np
def getFrame(queue):
frame = queue.get()
return frame.getCvFrame()
def getMonoCamera(pipeline,isLeft):
mono = pipeline.createMonoCamera()
mono.setResolution(dai.MonoCameraProperties.SensorResolution.THE_1200_P)
if isLeft:
mono.setBoardSocket(dai.CameraBoardSocket.LEFT)
else:
mono.setBoardSocket(dai.CameraBoardSocket.RIGHT)
return mono
if __name__ == '__main__':
# THE_720_P = 1280×720
# THE_800_P = 1280×800
# THE_400_P = 640×400
# THE_480_P = 640×480
# THE_1200_P = 1920×1200
pipeline = dai.Pipeline()
monoL = getMonoCamera(pipeline,isLeft= True )
monoR = getMonoCamera(pipeline,isLeft= False)
print("Reading calib data")
with dai.Device(pipeline) as device:
calibData = device.readCalibration()
print("...done")
# ======================================================
manipResize_L = pipeline.create(dai.node.ImageManip)
manipResize_L.initialConfig.setResize(640, 400)
manipResize_L.initialConfig.setKeepAspectRatio(True)
manipResize_R = pipeline.create(dai.node.ImageManip)
manipResize_R.initialConfig.setResize(640, 400)
manipResize_R.initialConfig.setKeepAspectRatio(True)
# ======================================================
monoR.out.link(manipResize_L.inputImage)
monoL.out.link(manipResize_R.inputImage)
# ======================================================
#print("--- Set up depth and disparity ---")
stereo = pipeline.createStereoDepth()
print("Check that everything is nice and cool")
# Check occluded pixels (performance hit)
stereo.setLeftRightCheck(True)
#stereo.setLeftRightCheck(False)
manipResize_L.out.link(stereo.left)
manipResize_R.out.link(stereo.right)
xoutDepth = pipeline.createXLinkOut()
xoutDepth.setStreamName("depth")
xoutDisp = pipeline.createXLinkOut()
xoutDisp.setStreamName("disparity")
#print("--- Set up rectified images links ---")
xoutRectLeft = pipeline.createXLinkOut()
xoutRectLeft.setStreamName("rectifiedLeft")
xoutRectRight = pipeline.createXLinkOut()
xoutRectRight.setStreamName("rectifiedRight")
#print("--- Set stereo config ---")
stereo.disparity.link(xoutDisp.input)
stereo.rectifiedLeft.link(xoutRectLeft.input)
stereo.rectifiedRight.link(xoutRectRight.input)
print("Setup done. Some checks first")
with dai.Device(pipeline) as device:
# Print MxID, USB speed, and available cameras on the device
print('MxId:',device.getDeviceInfo().getMxId())
print('USB speed:',device.getUsbSpeed())
print('Connected cameras:',device.getConnectedCameras())
print("Opening image queues")
with dai.Device(pipeline) as device:
print("Update debug log level")
# Set debugging level
device.setLogLevel(dai.LogLevel.DEBUG)
device.setLogOutputLevel(dai.LogLevel.DEBUG)
print("Set queues")
qDisp = device.getOutputQueue(name="disparity" , maxSize=1, blocking =False)
qRectL = device.getOutputQueue(name="rectifiedLeft" , maxSize=1, blocking =False)
qRectR = device.getOutputQueue(name="rectifiedRight" , maxSize=1, blocking =False)
scale = 255 / stereo.getMaxDisparity()
cv2.namedWindow("Stereo Pair")
cv2.setMouseCallback("Stereo Pair",mouseCallback)
sideBySide = False
print("Start loop")
while(True):
disparity = getFrame(qDisp)
disparity = (disparity*scale).astype(np.uint8)
#disparity = cv2.applyColorMap(disparity, cv2.COLORMAP_JET)
disparity = cv2.applyColorMap(disparity, cv2.COLORMAP_TURBO)
frameL = getFrame(qRectL)
frameR = getFrame(qRectR)
if sideBySide:
imOut = np.hstack((frameL,frameR))
else:
imOut = np.uint8(frameL/2 + frameR/2)
imOut = cv2.cvtColor(imOut,cv2.COLOR_GRAY2RGB)
imOut = cv2.line (imOut, (mouseX,mouseY), (1280,mouseY), (0,0,255), 2)
imOut = cv2.circle(imOut, (mouseX,mouseY), 2, (255,255,128), 2)
cv2.imshow("Stereo Pair",imOut)
cv2.imshow("Disparity",disparity)
k = cv2.waitKey(1)
if k==ord('q'):
break
elif k == ord('t'):
sideBySide = not sideBySide
Could you instruct more, please ?
Thanks and Best Regards,
Khang