Created
July 25, 2022 18:28
-
-
Save Erol444/0210c8af650ce8d15276729dcc21ce81 to your computer and use it in GitHub Desktop.
DepthAI OAK low latency evaluation script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import depthai as dai | |
from depthai_sdk import FPSHandler as FPS | |
# Create pipeline | |
pipeline = dai.Pipeline() | |
pipeline.setXLinkChunkSize(0) | |
# Define source and output | |
camRgb = pipeline.create(dai.node.ColorCamera) | |
camRgb.setFps(30) | |
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P) | |
camRgb.setIspScale(2,3) | |
# mono = pipeline.create(dai.node.MonoCamera) | |
# mono.setFps(60) | |
# mono.setBoardSocket(dai.CameraBoardSocket.RIGHT) | |
# mono.setResolution(dai.MonoCameraProperties.SensorResolution.THE_800_P) | |
videoEnc = pipeline.create(dai.node.VideoEncoder) | |
videoEnc.setDefaultProfilePreset(30, dai.VideoEncoderProperties.Profile.MJPEG) | |
camRgb.video.link(videoEnc.input) | |
xoutVideo = pipeline.create(dai.node.XLinkOut) | |
xoutVideo.setStreamName("video") | |
xoutVideo.input.setBlocking(False) | |
xoutVideo.input.setQueueSize(10) | |
# camRgb.isp.link(xoutVideo.input) | |
videoEnc.bitstream.link(xoutVideo.input) | |
# Connect to device and start pipeline | |
with dai.Device(pipeline) as device: | |
print(device.getUsbSpeed()) | |
fps = FPS() | |
video = device.getOutputQueue(name="video", maxSize=10, blocking=False) | |
while True: | |
videoIn = video.get() | |
diff = dai.Clock.now() - videoIn.getTimestamp() | |
print('diff', diff) | |
fps.nextIter() | |
print(fps.fps()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment