Cast
Cast Node is used to convert NNData messages to ImgFrame. This is useful in cases where applications need to use outputs from a NeuralNetwork node to be fed into nodes that only accept ImgFrame.Node properties
outputFrameType
- The type of the output frame. The type should be the same as the NN output frame type.offset
- The offset to be applied to the output frame. Default is0
.scale
- The scale factor to be applied to the output frame. Default is1
.
output = input * scale + offset
.How to place it
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2cast = pipeline.create(dai.node.Cast)
Inputs and Outputs
Usage
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2
3nn = pipeline.create(dai.node.NeuralNetwork)
4# Load a custom blob
5nn.setBlobPath("path_to_blob")
6
7cast = pipeline.create(dai.node.Cast)
8cast.setOutputFrameType(dai.ImgFrame.Type.BGR888p)
9cast.setScale(1)
10
11# Link the output of NN to the input of Cast
12nn.out.link(cast.input)
13
14# Send the casted output to a host via XLink
15xout = pipeline.create(dai.node.XLinkOut)
16xout.setStreamName("castOut")
17cast.output.link(xout.input)
Examples of functionality
Reference
class
depthai.node.Cast(depthai.Node)
method
setNumFramesPool(self, arg0: int) -> Cast: Cast
Set number of frames in pool Parameter ``numFramesPool``: Number of frames in pool
method
setOffset(self, arg0: float) -> Cast: Cast
Set offset Parameter ``offset``: Offset
method
setOutputFrameType(self, arg0: depthai.RawImgFrame.Type) -> Cast: Cast
Set output frame type Parameter ``outputType``: Output frame type
method
setScale(self, arg0: float) -> Cast: Cast
Set scale Parameter ``scale``: Scale
property
input
Input NNData or ImgFrame message.
property
output
Output ImgFrame message.
property
passthroughInput
Passthrough input message.
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.