Using roboflowoak, the depth is always 0 - zero



I am a beginner in Python, Roboflow, and working with the OAK-D camera. I was able to successfully execute the code as described in the guide “Deploy a Custom Model to OAK-D lite using roboflowoak

However, I am encountering an issue with my OAK-D lite camera: the depth value consistently reads as zero. I would greatly appreciate any guidance or suggestions you might have to resolve this issue.

Thank you for your time and assistance.

Based on the information provided in the extracts, it seems like you might be deploying to an OAK device without Depth capabilities. If this is the case, you should set depth=False when creating the rf object. OAK devices with Depth capabilities have a “D” attached to the model name, like OAK-D and OAK-D-Lite.

Here is the relevant code snippet:

from roboflowoak import RoboflowOak
import cv2
import time
import numpy as np

# When creating the 'rf' object, set 'depth=False' if your OAK device doesn't have Depth capabilities
rf = RoboflowOak(depth=False)

Also, if your device doesn’t have Depth capabilities, you should comment out the following lines:

# Comment these lines out if your OAK device doesn't have Depth capabilities
# max_depth = np.amax(depth)
# cv2.imshow("depth", depth/max_depth)

If you’ve done all of this and you’re still having issues, it might be a problem with the model or the device itself. In that case, I would recommend reaching out to Roboflow’s support for further assistance.


Hi! I’m Roboflow’s AI powered bot. This is an automated response powered using AI with knowledge from our docs, blog, knowledge base, and previous forum responses. If you find this to be a helpful answer, please mark it as the solution using the checkbox icon below. If this doesn’t solve your issue, please follow up with what you’ve tried/why, and the community will continue to chime in as usual.


Thanks for your answer.

But, I can garanty that is the modele OAK-D (for depth)

I already succeed to use depth value with another sample (for example all examples of the git project depthai-python work fine).

As I said, I used the documentation and here the display of ‘depth’ frame :

Please help

I think you are opening your depth image as a 8 bit , like your rgb image. The depth image is however a 16 bit number.

I cannot exactly recall how to solve this, but I think you have to add something like 16UC1 to the cv2 imread part


Thanks for the reply.

You said 'you have to add 16UC1 in the cv2 but seems that not the issue.
Please look here : “Deploy a Custom Model to OAK-D lite using roboflowoak

The commands are :

rf = RoboflowOak(model="YOUR-MODEL-ID", confidence=0.05, overlap=0.5,
    version="YOUR-MODEL-VERSION-#", api_key="YOUR-PRIVATE_API_KEY", rgb=True,
    depth=True, device=None, blocking=True)
result, frame, raw_frame, depth = rf.detect()
predictions = result["predictions"]

It’s before cv2 the issue occurs : predictions contains a depth value equal to zero.
I’m not talking about ‘depth’ frame (that’s contains the frame from the camera), but predictions[‘depth’]. Please look the first message.

Please need really help.

I meant the -1 flag or cv2.IMREAD_UNCHANGED. If that is not it, I cannot help you right now

Thanks for your help

I already said that’s not cv2 the issue ( I don’t need it for my process).

It’s the predictions result : depth is equal to 0 (zero).
I need the depth of objects detected.

any update on this thread? i have the same issue as well…have a OAK D Pro with depth, depth works very well with the Luxonis pipeline code, but get zero depth as the return when using the RoboflowOak module.

PREDICTIONS [{‘x’: 231.0, ‘y’: 163.5, ‘width’: 270, ‘height’: 327, ‘depth’: 0, ‘confidence’: 0.80712890625, ‘class’: ‘tennis-ball’}]