How can i find the resolution of an image?

조회 수: 143 (최근 30일)
Carole
Carole 2012년 11월 16일
댓글: Palguna Gopireddy 2022년 11월 27일
Hi, how i can find the resolution of an image with matlab (number of pixels in millimeter). thanks
  댓글 수: 3
Image Analyst
Image Analyst 2019년 8월 24일
See solutions below. What imfinfo gives you might not always contain xresolution, and when it does, it may not be correct or what you think. For example
fi = imfinfo('cameraman.tif')
gives 72 inches. Obviously not correct or even applicable. However, it might be correct depending on the image capture system.
Walter Roberson
Walter Roberson 2019년 8월 24일
In my experience, XResolution and YResolution information returned by imfinfo() is wrong much much more often than it is correct.

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

답변 (6개)

Thomas
Thomas 2012년 11월 16일
편집: Thomas 2012년 11월 16일
Use 'imfinfo'
E.g.
info = imfinfo('new1.jpg')
info =
Filename: [1x95 char]
FileModDate: '01-Oct-2001 17:19:44'
FileSize: 27387
Format: 'jpg'
FormatVersion: ''
Width: 600
Height: 650
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {[1x69 char]}
There you can fine the resolution widthxheight bit depth etc..
  댓글 수: 10
Walter Roberson
Walter Roberson 2012년 11월 16일
Good point, Eric. Carole, is the image of a single spot or is it of a larger area that you moved along?
Carole, XResolution is an optional EXIF tag. In most cases it is not known or not meaningful.
Carole
Carole 2012년 11월 16일
Sorry for the stupid questions but I like to understand. So what's the solution to convert a diameter of a region in pixel to millimeter. is there a trick using a regle of three for example? or what is the parameter necessary to make this conversion?

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


Walter Roberson
Walter Roberson 2012년 11월 16일
Most often, you cannot figure out what the resolution of an image is.
If you are using a better-quality camera in auto-focus mode, the EXIF information might include the distance to the focus. If you have that and the lens aperture, then by knowing the height and width in pixels, you can calculate the angle subtended by the pixel range, and thus the angular resolution. (Perhaps you do not need the aperture; I have forgotten the details of the calculation.)
If you are using a medical device such as CT or MRI, then the images for those are usually created as DICOM images, for which there is DICOM meta-data that includes the resolution in the PixelWidth tag.
  댓글 수: 2
Carole
Carole 2012년 11월 16일
편집: Carole 2012년 12월 20일
I do not know the resolution. I want to calculate the resolution from the image. Is this possible??
Eric
Eric 2012년 11월 16일
편집: Walter Roberson 2019년 8월 24일
It looks to me like the device has no imaging capability ( http://www.delasco.com/pcat/1/Diagnostic/Delta20/Delta20/ ). You need to pair it with another camera. I would say your best bet would be to do your own calibration of the systems. You could buy a resolution target (something like an Air Force 1951 resolution target from Edmund Optics) that has small features of known sizes. Image them and determine what the resolution is that way.
-Eric

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


Carole
Carole 2012년 11월 17일
편집: Carole 2012년 11월 17일
I'm looking for the solution to convert a diameter of a region in pixel to millimeter. is there a trick using a regle of three for example? or what is the parameter necessary to make this conversion? I have these informations but I don't know how can I use it:
-the resolution of the device is 41.1 megapixel
-1 megapixel = 0.264 mm
-1 dpi = 3.937 pixels/mm
  댓글 수: 7
Walter Roberson
Walter Roberson 2012년 11월 18일
How about you tell us the make and model of what you are using, so we can see if we can understand the manual?
Palguna Gopireddy
Palguna Gopireddy 2022년 11월 27일
If you have studied the Digital Image Processing by Gonzalez Book. You understand that 'Resolution can't be explicitely mentioned using the pixels. It has to be mentioned along with dpi value'. For exmaple 512*512 image with 72dpi has better resolution compared to 512*512 image with 36dpi

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


Image Analyst
Image Analyst 2012년 11월 18일
편집: Image Analyst 2012년 11월 18일
Carole, Sure, go for it. So multiply any lengths in pixels by 0.022 to get length in mm, and multiply and area in pixels by 0.022^2 to get area in mm^2. Of if you know the length and height of the total image field of view then you can use that too. For example, if the height = 960 pixels and it's 21 mm. Then the spatial calibration factor is 21/960 = 0.021875 mm per pixel. So let's say an object is 342 pixels long, well that's 342 * 0.021875 = 7.48125 mm long. If the area = 20,000 pixels, it's 20,000 * 0.021875^2 = 9.57 mm^2 in area.
  댓글 수: 10
Walter Roberson
Walter Roberson 2012년 11월 20일
Especially a picture of something of known size, such as a ruler.
Image Analyst
Image Analyst 2012년 11월 20일
The how did you get the pictures? Did you get them from that dermascope or not? If not, where did they come from and what does the dermascope have to do with anything?
And the print size has nothing at all to do with any kind of distance in your image. I could print a picture of a galaxy and a picture of a virus both on the same size paper printout with the same size image pixel dimensions. But of course their spatial calibration is vastly different.

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


TIAN YUAN WANG
TIAN YUAN WANG 2017년 6월 30일
I'm sure you can get the FOV size from the Dicominfo.
If the FOV is 400 mm, matrix is 512 by 512; then the Resolution = FOV/matrix = 400/512 = 0.7813 mm/pixel.
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 6월 30일
Unfortunately the person was working with a png not with a dicom image.
Looking at the fov is typically the wrong way to get sizing from dicom images. The best way depends upon what kind of image it is. I do not recall the best way for CT. MRI images have a pixel centre to centre for x and y that can be used. (The tricky part is determining the z resolution)

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


Antonis L
Antonis L 2020년 6월 16일
Ιs it possible to find the real image dimensions of a .jpeg, through the XResolution and the YResolution given from the imfinfo function, without the pixel/mm reconstruction factor? Τhank you in advance
  댓글 수: 6
Image Analyst
Image Analyst 2020년 8월 4일
No. It's not possible. There is no such conversion that works for all or most jpg images and all/most fields of view. You have to calibrate your specific image. See attached spatial calibration demo.
Walter Roberson
Walter Roberson 2020년 8월 5일
You would need to know the distance between the image sensor and the lens:
When f is the focal length and is the distance between the sensor and the lens, and is the distance between the lens and the object being photographed, then
By knowing the image sensor physical size, and its resolution, and the portion of the image that the object of interest occupies, you can determine the physical size of the sensor portion covered by the projection of the image. Then you can use the recorded readings such as aperture and distance to the target together with the optical formulas, to figure out what the physical size of the distant object must have been. You then combine the physical size of the object with the number of pixels needed to represent it to find the resolution.
Alternately if you know the physical size of the object and the number of pixels needed to represent that size, you can directly calculate resolution.
The further you get from the object, the more imprecise the calculations get. It doesn't take much in casual photography before is sufficiently smaller than as to get lost in the noise of the imprecision of measuring

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by