ImageManip resize
This example showcases how to use ImageManip node to resize the input image. Because aspect ratio isn't the same (input image: 16:9, output image: 1:1), theResizeMode takes an effect and the output image is stretched. You can find more information about resize modes here.Demo
This example requires the DepthAI v3 API, see installation instructions.Pipeline
Source code
Python
C++
Python
PythonGitHub
1import depthai as dai
2import cv2
3
4pipeline = dai.Pipeline()
5
6camRgb = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_A)
7manip = pipeline.create(dai.node.ImageManip)
8
9manip.initialConfig.setOutputSize(300, 300, dai.ImageManipConfig.ResizeMode.STRETCH)
10
11camOut = camRgb.requestOutput((1920, 1080))
12camOut.link(manip.inputImage)
13
14manipQ = manip.out.createOutputQueue()
15camQ = camOut.createOutputQueue()
16
17pipeline.start()
18
19while True:
20 if manipQ.has():
21 cv2.imshow("Manip frame", manipQ.get().getCvFrame())
22 if camQ.has():
23 cv2.imshow("Camera frame", camQ.get().getCvFrame())
24 key = cv2.waitKey(1)
25 if key == ord('q'):
26 breakNeed assistance?
Head over to Discussion Forum for technical support or any other questions you might have.