Skip to main content

Customising the OAK-D Pro camera

If you haven't already, please make sure to set up all prerequisites available in our first introduction to the OAK-D Pro camera available here before following this tutorial. You can also follow the tutorial to set up the OAK Device CHOP and OAK Select TOP. 

The following provides a couple of customisation examples:

1. Capturing in Wide-Angle

# me - this DAT
# oakDeviceOp - the OP which is cooking

import depthai as dai

def onInitialize(oakDeviceOp, callCount):
	return 0

def onInitializeFail(oakDeviceOp):
	parent().addScriptError(oakDeviceOp.scriptErrors())
	return

def onReady(oakDeviceOp):
	# We get the depthai.Device object as `device`
	# https://docs.luxonis.com/projects/api/en/latest/components/device/	
	# if device := oakDeviceOp.lockDevice():
	# 	queue = device.getInputQueue("config")
	# 	queue.setMaxSize(4)
	# 	oakDeviceOp.unlockDevice()
	return
	
def onStart(oakDeviceOp):
	return

def whileRunning(oakDeviceOp):
	return

def onDone(oakDeviceOp):
	return

def createPipeline(oakDeviceOp):
    pipeline = dai.Pipeline()
    cam = pipeline.create(dai.node.ColorCamera)
    xoutIsp = pipeline.create(dai.node.XLinkOut)
    xoutPrev = pipeline.create(dai.node.XLinkOut)
    xoutIsp.setStreamName('isp')
    xoutPrev.setStreamName('preview')

    cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
    cam.setInterleaved(False)
    cam.setIspScale(1, 2)
    cam.setPreviewKeepAspectRatio(False)
    cam.setPreviewSize(1280, 720)  # or any desired preview resolution

    cam.preview.link(xoutPrev.input)  # wide-angle output

    return pipeline

 

2. Capturing in Wide-Angle