Skip to content

Commit

Permalink
Merge pull request #910 from luxonis/stereo_from_host_example
Browse files Browse the repository at this point in the history
Add more options to the stereo_from_host_example
  • Loading branch information
moratom authored Oct 20, 2023
2 parents ba9497a + ed3dc76 commit fbd86e6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions examples/StereoDepth/stereo_depth_from_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
parser.add_argument("-e", "--evaluate", help="Evaluate the disparity calculation.", default=None)
parser.add_argument("-dumpdispcost", "--dumpdisparitycostvalues", action="store_true", help="Dumps the disparity cost values for each disparity range. 96 byte for each pixel.")
parser.add_argument("--download", action="store_true", help="Downloads the 2014 Middlebury dataset.")
parser.add_argument("--calibration", help="Path to calibration file", default=None)
parser.add_argument("--rectify", action="store_true", help="Enable rectified streams")
parser.add_argument("--swapLR", action="store_true", help="Swap left and right cameras.")
args = parser.parse_args()

if args.evaluate is not None and args.dataset is not None:
Expand Down Expand Up @@ -603,8 +606,12 @@ def __init__(self, config):
stereo.setRuntimeModeSwitch(True)

# Linking
monoLeft.out.link(stereo.left)
monoRight.out.link(stereo.right)
if(args.swapLR):
monoLeft.out.link(stereo.right)
monoRight.out.link(stereo.left)
else:
monoLeft.out.link(stereo.left)
monoRight.out.link(stereo.right)
xinStereoDepthConfig.out.link(stereo.inputConfig)
stereo.syncedLeft.link(xoutLeft.input)
stereo.syncedRight.link(xoutRight.input)
Expand All @@ -630,9 +637,11 @@ def __init__(self, config):
StereoConfigHandler.registerWindow("Stereo control panel")

# stereo.setPostProcessingHardwareResources(3, 3)

if(args.calibration):
calibrationHandler = dai.CalibrationHandler(args.calibration)
pipeline.setCalibrationData(calibrationHandler)
stereo.setInputResolution(width, height)
stereo.setRectification(False)
stereo.setRectification(args.rectify)
baseline = 75
fov = 71.86
focal = width / (2 * math.tan(fov / 2 / 180 * math.pi))
Expand Down

0 comments on commit fbd86e6

Please sign in to comment.