I am trying to calculate the dimensions of an object in an image. This is a sample image I took to get height of blue shirt:
I am following the math from this page with sastanin's answer. How do I calculate the distance of an object in a photo?
The real height of the object is ~90cm, so X=0.9m
. I took the image from 92inches away so d=2.3368m
. I used a Samsung note 4 phone to get the image. They have a focal length of 4.8mm, so f=4.8mm
. They also have 72ppi
. I emailed myself the image and opened in photoshop, and measured the pixels of the blue shirt in height, and it came to 1690pixels.
If I convert it to mm using the ppi, I get x=596.19mm
.
So then using the equation, I am getting
(596.194444444/4.8)*2.3368 = 290.247328703
which says the shirt is ~290m in height.
So there is clearly something wrong with the math here. Does anyone know?
EXIF data:
ExifTool Version Number : 10.01
File Name : 20160715_202056.jpg
Directory : .
File Size : 4.1 MB
File Modification Date/Time : 2016:07:15 22:12:49-04:00
File Access Date/Time : 2016:07:15 22:13:05-04:00
File Inode Change Date/Time : 2016:07:15 22:13:02-04:00
File Permissions : rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Make : samsung
Camera Model Name : SM-N910W8
Orientation : Rotate 90 CW
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Software : N910W8VLU1DPE2
Modify Date : 2016:07:15 20:20:55
Y Cb Cr Positioning : Centered
Exposure Time : 1/10
F Number : 2.2
Exposure Program : Program AE
ISO : 400
Exif Version : 0220
Date/Time Original : 2016:07:15 20:20:55
Create Date : 2016:07:15 20:20:55
Components Configuration : Y, Cb, Cr, -
Shutter Speed Value : 1/10
Aperture Value : 2.2
Brightness Value : -1.35
Exposure Compensation : 0
Max Aperture Value : 2.2
Metering Mode : Center-weighted average
Light Source : Unknown
Flash : No Flash
Focal Length : 4.8 mm
User Comment : .
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 5312
Exif Image Height : 2988
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
Sensing Method : One-chip color area
Scene Type : Directly photographed
Exposure Mode : Auto
White Balance : Auto
Focal Length In 35mm Format : 31 mm
Scene Capture Type : Standard
Image Unique ID : H16USHH04SA
GPS Version ID : 2.2.0.0
Compression : JPEG (old-style)
Thumbnail Offset : 3318
Thumbnail Length : 7352
Image Width : 5312
Image Height : 2988
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Aperture : 2.2
Image Size : 5312x2988
Megapixels : 15.9
Scale Factor To 35 mm Equivalent: 6.5
Shutter Speed : 1/10
Thumbnail Image : (Binary data 7352 bytes, use -b option to extract)
Circle Of Confusion : 0.005 mm
Field Of View : 60.3 deg
Focal Length : 4.8 mm (35 mm equivalent: 31.0 mm)
Hyperfocal Distance : 2.25 m
Light Value : 3.6
Answer
PPI has nothing to do with the calculation. I calculate the Note 4's 1/2.6" sensor's dimensions to be about 5.80mm × 3.27mm. So using 5.80mm as the sensor height (the image is in portrait orientation, so we need the sensor's long dimension for image height) in the equation in Matt Grum's answer in the question you linked to, and rearranging the equation to solve for 'real height(mm)',
Which agrees with your ~90cm jacket height.
No comments:
Post a Comment