Determining Voxel Size from Depth Maps or other meta data


I am working with depth maps which have been generated with ZED 2i camera in PNG format. I need to determine the voxel size in order to find the volume of some objects.

Could anyone please advise if it’s possible to extract the voxel size from the metadata of a depth map? If the depth map format typically does not include this information, are there alternative methods or best practices for accurately determining the voxel size?

Any guidance or suggestions would be greatly appreciated.

Thank you!

Hi @code_lover
can you provide more details?

1 Like

Thank you for responding to my query.

Voxel size refers to the real-world dimensions that each voxel (3D pixel) represents in a depth image. For instance, if a depth camera’s metadata specifies a voxel size of 1 mm, it means each voxel in the depth map corresponds to a cubic space of 1 mm x 1 mm x 1 mm in the real world.

Some cameras, especially those designed for 3D scanning and depth sensing, often store the voxel size in the metadata of the depth map. By knowing the voxel size, one can precisely calculate the real-world volume and dimensions of objects captured in the depth map.

unfortunately, this information is not natively available in PNG images saved with ZED Depth Viewer.
You must calculate voxel size by applying the camera calibration information to each pixel.

1 Like

Could you please let me know if any example available for this purpose? Thank you!

You must use runtime information.
The horizontal and vertical FoV allows you to calculate the aperture width at a fixed depth:
W = 2 x depth x tan(h_fov/2)
H = 2 x depth x tan(v_fov/2)
The width and height of each voxel is the aperture divided by the horizontal and vertical depth map resolution:
vox_w = W/h_res
vox_h = H/v_res

The only problem is that you cannot estimate the thickness of each voxel if not by getting the information by rotating the camera around the object to be measured

1 Like