Hello, i am new to depthai so i dont know much. i am trying to create a code that detects object and show its xyz coordinates, i am using this example: https://docs.luxonis.com/projects/sdk/en/latest/samples/NNComponent/sdk_spatial_detection/
however when i try it with my oak-d pro, the accuracy of the depth is wrong. it says that an object 40 cm. away is 1.3 mts and when i put it closer the depth goes higher. Can someone help me try to fix this or show me different ways of achieving this? thanks!
this is the code:
from depthai_sdk import OakCamera
import depthai as dai
with OakCamera() as oak:
color = oak.create_camera('color')
# List of models that are supported out-of-the-box by the SDK:
# https://docs.luxonis.com/projects/sdk/en/latest/features/ai_models/#sdk-supported-models
nn = oak.create_nn('mobilenet-ssd', color, spatial=True)
nn.config_spatial(
bb_scale_factor=0.5, # Scaling bounding box before averaging the depth in that ROI
lower_threshold=30, # Discard depth points below 30cm
upper_threshold=10000, # Discard depth pints above 10m
# Average depth points before calculating X and Y spatial coordinates:
calc_algo=dai.SpatialLocationCalculatorAlgorithm.AVERAGE
)
oak.visualize(nn.out.main, fps=True)
oak.visualize([nn.out.passthrough, nn.out.spatials])
oak.start(blocking=True)