I am trying to calculate the dimensions of an object in an image. This is a sample image I took to get height of the brown box. I have this white box which measures 16cm and I would like to know the height of the brown box (in meter). This using only the focal length and the size of the camera sensor of my phone. Focal Length: 3.99mm Focal Length In 35mm Size: 29 mm Sensor size: 4.8mm * 3.5mm Height of the image: 4032px Size of the brown box in pixels: 1459px Distance between the sensor and the box: 1.8m I did this: So I found boxheight = 0.78m In reality, this brown box measures 0.75m, so I want to know if it’s possible to obtain a more accurate result by using the fact that I know the exact size of the white box next to it. Does anyone know ? Thank you
You're making the calculations too complicated. When you have a known reference measurement in an image to compare the unknown against, just use the known reference as the unit of measurement.
In my image editor, I measure the height of the white box as ~176 pixels, and the height of the brown box as ~884 pixels. The brown box is thus 884/176 = 5.02 times taller than the white box.
And because the white box is given as 16 cm, the brown box is therefore 16 * 5 = 80 cm tall.
Note that this is exactly what crime scene photographers do when they lay down a forensic ruler / scale next to something they want to photograph at the scene.
You also sometimes see police lay down a coin or a dollar bill next to the item being photographed if they don't have a forensic scale with them. (At least, you see it sometimes on law/police procedural TV shows and movies. Whether or not that is common or rare in real-world police work, I don't know). The point is to put a known reference measurement in the photograph, so future analysis of the photographed evidence will can always be done.