RealSense expert Samontab had this advice about calculating pixel sizes at different resolutions:
"The pixel size is a physical measurement of the actual sensor element. If you change the resolution of the stream, this usually just means that you are changing the number of pixels used from the sensor. ... The distance of the objects is totally irrelevant to the size of the pixels. Basically, if you know the sensor size, you can just divide it by the maximum native resolution, and that should give you an estimated pixel size."
Samontab had this further advice for calculating sensor size and pixel size.
You have QueryColorFocalLengthMM which gives you focal length in mm, and also QueryColorFocalLength, which gives you focal length in pixels. With those two values you can get the size of a pixel in mm.
Or you could have more fun with trigonometry:
1. Measure an object's width, in mm.
2. Measure the object's distance to the camera, in mm. (Maybe use RealSense!).
3. Look at the object with the camera you want to measure, and measure its width in number of pixels.
4. The object width in pixels / the focal length in pixels = object width in mm / object distance in mm