• DepthAI-v2
  • Standalone Mode getCvFrame Attribute error

I've had some issues getting standalone mode running with getCvFrame running, running into the error that the 'lbp.ImgFrame' object has no attribute 'getCvFrame' which, according to the docs, should be a functional attribute to query.

Here's the relevant code:

pipeline = dai.Pipeline()

camRgb = pipeline.create(dai.node.ColorCamera)
camRgb.setPreviewSize(300, 300)

camRgb.setFps(10)
camRgb.setInterleaved(False)

nn = pipeline.create(dai.node.MobileNetDetectionNetwork)
nn.setConfidenceThreshold(0.5)
nn.setBlobPath(blobconverter.from_zoo(name="mobilenet-ssd", shaves=6))
frame_builder = pipeline.create(dai.node.VideoEncoder)
camRgb.preview.link(nn.input)
frame_builder.setDefaultProfilePreset(camRgb.getFps(), dai.VideoEncoderProperties.Profile.MJPEG)
camRgb.video.link(frame_builder.input)

script = pipeline.create(dai.node.Script)
script.setProcessor(dai.ProcessorType.LEON_CSS)

nn.out.link(script.inputs['detections'])
frame_builder.bitstream.link(script.inputs['frame'])

and then in the Script node

imgFrame = node.io['frame'].get()

cvFrame = imgFrame.getCvFrame()

I'd presume I'm missing something straightforward. I'm eventually hoping to be able to implement a non-blocking queue of the last few frames once this is fixed, to skip lagging behind realtime on heavy operations.

    lewismerriman cvFrame = imgFrame.getCvFrame()

    Why do you need this call? The script node doesn't feature OpenCV, so calling that won't work. You can use getData() if you need to alter it in any way.

    Thanks,
    Jaka

      9 days later

      jakaskerl

      Thanks for this, I'll give it a go. The reason for the call is that I need to be able to grab the frame such that I can convert it to base64 and push it over mqtt, but all the standalone mode examples I can find do most of the pipeline calls in script node