I may be misunderstanding what you're asking, but if you know the sensor size and the number of pixels in the object, then you can calculate the object size. For example, a Canon 7D has an APS-C sensor that's 22.3 x 14.9mm and 5184 x 3456 pixels. That works out to ~0.0043mm/pixel. So if you have an object that's 250 pixels wide, then the projection of the object onto the sensor would have been 250 pixels * 0.0043mm/pixel = 1.075mm wide.
EDIT:
So just for fun, I gave this a try. I took a 300mm ruler, put it at 1 meter from the camera and shot it with a 50mm lens on a Canon 7D. According to the ruler tool in Photoshop, it was 3734 pixels wide. That gives me the following equation:
3734 * 0.0043 = (300 * 50) / 1000
or
16.0562 = 15.0
Well, it's close, but not exact. (Over by 7%.) My guess is that the sensor site size is actually slightly smaller than 0.0043mm or the sensor size is slightly bigger than the reported size. In fact, the specs for the camera say 18MP effective size, but 19MP actual sensor size. So I'm not sure what that means, but I'm guessing it explains the difference between my actual result and the calculated result. (Either that or I'm misreading the length in Photoshop and it should actually be 3488 pixels instead of 3734.) But it was fun to try!
2nd EDIT: This question on the Photo Stack Exchange explains it. Camera lenses are often slightly longer or shorter than claimed, but rounded to the nearest nice focal length. So (assuming my calculations and measurements were correct) my lens is actually a ~53.5mm lens.