I'm using a cell phone to capture an image of two objects (O1 and O2) on a flat plane and my camera is level with respect to this plane (the phone and the plane are both parallel). One of these objects (O1) is almost flat with a thickness of ~ 1mm and all of its dimensions (length and width) are known. This includes both its real-world size as well as pixel dimensions.
My objective is to find the dimensions of the other object (O2) in the image and the only thing I know for a fact is its height. I'd like to compute its length and width given this image. It is not as flat as the first object and as such, is closer to the camera. Thus, it appears to be slightly magnified in the image.
My question is this - since I do know how tall O2 is, is it possible to find its dimensions using O1's size, while taking into consideration that O2's dimensions in the image are magnified when compared to those of O1?
If there's a solution that will require taking two images or calibrating the camera, I'm open to those as well, but I'd prefer a method that is independent of these parameters. I've attached an image below that should help with visualizing the scenario.