Hi there, I am trying to estimate the size of objects on a conveyer belt using the OAK-D- Lite camera.

Can you please help me in converting the dimensions of the bounding box which are in pixels into actual metric dimensions??
NOTE:The objects are in same depth so the conversion factor for one would work upon for every other object also

Hi @AbhishekSrivastava

  1. get SpatialImageDetections from https://docs.luxonis.com/projects/api/en/latest/samples/SpatialDetection/spatial_tiny_yolo/#rgb-tinyyolo-with-spatial-data

    # If the frame is available, draw bounding boxes on it and show the frame
            height = frame.shape[0]
            width  = frame.shape[1]
            for detection in detections:
                detection: dai.SpatialImgDetection
                roiData = detection.boundingBoxMapping
                roi = roiData.roi
                roi = roi.denormalize(depthFrameColor.shape[1], depthFrameColor.shape[0])
                topLeft = roi.topLeft()
                bottomRight = roi.bottomRight()
                xmin = int(topLeft.x)
                ymin = int(topLeft.y)
                xmax = int(bottomRight.x)
                ymax = int(bottomRight.y)
                cv2.rectangle(depthFrameColor, (xmin, ymin), (xmax, ymax), color, 1)
  2. You should have 4 points, each with their own X, Y, Z values.

  3. Calculate the size by subtracting them

Thanks,
Jaka