How to find the actual size of an existing object from the pixels of an image? I am quite new to vision and OpenCV, so forgive me if this is a stupid question but I have got really confused.

My aim is to detect an object in an image and estimate its actual size. Assume for now I only want length and width, not depth.
Lets say I can detect the object, find its size(length and width) in pixels and I have both the intrinsic and extrinsic parameters of the camera.

The documentation of camera calibration as I understand says that the intrinsic and extrinsic camera parameters can be used to transform from camera coordinate system to world coordinate system. So this should mean converting from pixel coordinates to real coordinates right? And so I should be able to use pixel size and these parameters to find the real size?

But, say the object is photographed at different depth (distance from camera), then its size would come out different using above method. So.....what does it mean transforming from camera to world coordinates?

Any kind of explanation/links/help would be highly appreciated.
I really am no expert in cameras (nor in OpenCV in which I'm pretty sure everything can be handled automatically et efficiently without doing calculations yourself). But without knowing the distance between the lens and your object, that will be difficult.

Actually, knowing the focal length of your camera and the distance from the nodal point to the image plane, you can deduce the distance from the nodal point to the object. Then just use Thales' theorem and you can do exactly what you want.

The problem of this method is that it relies on how well the focus is done on the camera. And because of the varying depth of field of your camera, the magnitude of the error will vary too. AFAIK, this method should work pretty well for short distances. For longer ones, that can be very difficult as the focal point is near infinity and the depth of field is really large.

As an alternative, you can put an object of known size next to the object which size you are measuring. Thales' theorem again and you get your data.