Wikipedia:Reference desk/Archives/Computing/2021 June 1

From Wikipedia, the free encyclopedia
Computing desk
< May 31 << May | June | Jul >> June 2 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 1[edit]

Get object distance from digital picture[edit]

Is there any way to obtain the object distance from a digital picture? That distance is known to the camera. Indeed, most traditional cameras lenses allow the user to adjust by turning a ring on the lens, which has markings for . But I can't find in any Exif properties. (Alternatives include using the image distance and the formula , or even such information as the width of the frame in the object plane, but I can't find any of those, either.) ◅ Sebastian 09:36, 1 June 2021 (UTC)[reply]

Actually, this depends on the camera. As I just read at https://www.dpreview.com/forums/thread/3195972, the image shown at https://www.flickr.com/photos/dojoklo/4969420110/meta/in/set-72157622909766424 has that information. ◅ Sebastian 09:51, 1 June 2021 (UTC)[reply]

My Pixel 3a phone adds this field (assuming it's "subject distance") but the value is very inaccurate (or downright nonsense) in some of the photos (landscapes) that I've checked. -- Finlay McWalter··–·Talk 15:57, 1 June 2021 (UTC) edit yes, that field is 0x9206; the "nonsense" was 0xFFFFFFFF (==infinity), but other landscapes with the centre of the image being about 100m away report 2.7m, so it's not super useful. -- Finlay McWalter··–·Talk 16:10, 1 June 2021 (UTC)[reply]
The distance value in Exif of my photos is way off. Bubba73 You talkin' to me? 23:33, 1 June 2021 (UTC)[reply]
If you know the size of the object and the camera details, and details about how the image was cropped then you can calculate the distance. Bubba73 You talkin' to me? 00:26, 2 June 2021 (UTC)[reply]
To a camera, the distance to the object is relevant for focus – and maybe to set the amount of light emitted by the flash, but I don't know to what extend cameras are smart enough for that. When the object is far away compared to the size of the optical system (focal distance and aperture), changes in hardly affect , so it no longer matters. And indeed, the error bars on the distance get very large for far-away objects. Phone cameras are very small, so an object farther than a few metres is practically at infinity. (The amount of light emitted by the flash should increase with the square of the distance to the object, so here accuracy in distance matters even at larger distances, except that with the object at a few metres, the flash is already at maximum output, so at large distances you can simply disable flash. Although I've seen people use flash when taking landscape pictures in the dark.) PiusImpavidus (talk) 08:24, 2 June 2021 (UTC)[reply]