Hello
What happens when using non-standard camera resolutions?
I was using [3840, 2160] for my OAK-D Pro W camera, instead of the maximum resolution of [4032, 3040].
And I noticed when restarting the camera, the video stream was not always centered.
Is there a way to centre the video?
def createPipeline(self, pipeline, mxId: str) -> tuple[dai.Pipeline, dai.MessageQueue | None]:
if self.high_resource_mode and self.mode:
pipeline.setXLinkChunkSize(0) # to avoid splitting the encoded frames into chunks (important for 4k)
global filename
os.makedirs(os.path.join(self.cam_path), exist_ok=True)
filename = os.path.join(self.cam_path, f"video_{mxId}.encoded")
# Camera settings from spec
spec = load_camera_spec(mxId)
if self.mode:
fps = spec["fps"]
resolution = tuple(spec["resolution"])
exposure = spec["exposure"]
else:
fps = 30
resolution = (1280, 800)
exposure = spec["exposure"]
# Camera queue definitions
cam = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_A)
cam_input = cam.inputControl.createInputQueue()
# Camera settings (Input)
ctrl = dai.CameraControl()
ctrl.setAutoExposureLimit(exposure)
cam_input.send(ctrl)
# Camera Output
if self.mode:
if self.high_resource_mode:
output = cam.requestOutput(
resolution,
type=dai.ImgFrame.Type.NV12,
enableUndistortion=True,
fps=fps
)
encoded = pipeline.create(dai.node.VideoEncoder).build(
output, frameRate=fps, profile=dai.VideoEncoderProperties.Profile.MJPEG
)
self.video_savers.append(pipeline.create(VideoSaver).build(encoded.out))
return pipeline, None
return pipeline, output