Measuring object dimensions from stereo maps

I am trying to measure object dimensions from opencv disparity maps. My progress so far is:

  1. I have my two cameras calibrated and I have their metrices.
  2. I create disparity map from two images (one from each camera) using StereoSGBM.
  3. I reproject disparity map to 3D space.
  4. Now I open any one image of those used to create disparity, I place a rectangle there, get its 2D coordinates back.
  5. I get the 3D coordinates of this rectangle from the reprojected image to 3D using the 2D coordinates as indices.
  6. For each relevant set of coordinates (e.g. top-left/top-right) I compute the distance based on the 3D coordinates as SQRT (dx^2 + dy^2 + dz^2)
    Now my questions are:
  7. Is this the correct way to measure dimension?
  8. This calculated dimension is for an object in 3D space, so obvious enough as the object gets deeper in the image, the dimension gets smaller, now how can I know the real object dimension? p.s. I don’t know how deep the object would be, and I don’t know any of its dimensions apriori. Also, there are no reference objects in the picture.
  9. I don’t seem to understand the 3D points generated from disparity as I don’t know what are the X,Y,Z coordinates of any pixel are referenced to (where is the origin), and what is the unit of measurement (is it in pixel, mm,…etc, or a factor related to focal length?)
    Thanks