필터 지우기
필터 지우기

How can I find the pixel size of an image?

조회 수: 20 (최근 30일)
Ann G
Ann G 2016년 4월 5일
댓글: Walter Roberson 2017년 8월 17일
I want to know the pixel size to calculate the size of an image...
number of pixels * pixel size

채택된 답변

Image Analyst
Image Analyst 2016년 4월 5일
See my spatial calibration demo. If you know the size of something in the image, such as a ruler, then you can spatially calibrate your image. See attached demo.
  댓글 수: 2
Thao Nguyen
Thao Nguyen 2017년 8월 17일
Somehow I got this message:
Undefined function or variable 'Calibrate'.
Walter Roberson
Walter Roberson 2017년 8월 17일
function Calibrate is part of that .m file, so it should be found if you copied in the entire .m file.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 5일
In general you cannot do that, and a lot of the time when you can get some information, the information is just plain wrong. But the times you can get information, it would be stored in either EXIF headers (JPEG, TIFF) or TIFF headers (TIFF). The EXIF information, when present, can be retrieved by using imfinfo() and looking at the DigitalCamera field of the returned structure (note: the field might not be present.) TIFF headers that are not automatically synthesized to EXIF need to be read using the Tiff class.
  댓글 수: 2
Ann G
Ann G 2016년 4월 5일
Thank u!!
Walter Roberson
Walter Roberson 2016년 4월 5일
Note that Image Analyst has a demo on Spatial Calibration -- that is, if you can point to two things in the image and say how far apart they are "really", then his demo can calculate any other distances on the image. This does not rely on any information stored in the file, but it does rely upon there being knowledge of "real" sizes of something in the picture.
Also, when you are using a camera that is designed as a scientific instrument, or is sufficiently high-end (probably not consumer level), then there might be enough EXIF or TIFF headers stored to be able to calculate some distances without knowing the "real" size of something in the image. That calculation requires information about the aperture size and lens focal length, and some depth-of-field calculations, and might require some information about how far away the autofocus thought the object was.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by