You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Is this formula correct??
2 views (last 30 days)
Show older comments
Hello,
To find the real size of an object can I use this formula
Objects original size (in m) = Objects size on sensor (in mm) * distance between camera and object (in m) / focal length (in mm)
knowing these informations
size of object: 400 pixels
working distance: 31 mm
thanks
4 Comments
Walter Roberson
on 3 Dec 2012
Is this still to try to find the real size of objects with the dermotoscope ?
Walter Roberson
on 3 Dec 2012
We still don't understand why you don't just put an object of known size into the device and measure on the resulting image??
Answers (1)
Image Analyst
on 3 Dec 2012
Yes, that is the thin lens equation. Do you have all those quantities? Note that the size of the object is in mm, not pixels. So you have to know what length 400 pixels corresponds to on your sensor. And 31 mm is awfully close - are you sure the thin lens equation holds in that kind of "macro focus" situation? I have doubts. And if you use a good lens, for things very close (not at infinity) then the thin lens equation is not so clear. The working distance (scene-to-front of lens) is not the same as the scene-to-front principal plane for a thick lens.
This seems like the hard way of doing it though. Why not just measure something of a known length to get a spatial calibration factor?
24 Comments
Carole
on 3 Dec 2012
Edited: Carole
on 3 Jan 2013
thanks
I don't have much knowledge in this field but I'm trying to understand. This formula is used regardless of the device used??
-objet lenght is 105.6 mm with magnification *10: so it is 10.56
-Yes I'm sure about the distance working
-The focal length is 35 mm???
I found also this formula but I don't know what is the correct one
real height of the object (mm) = object height (pixels) * sensor height (mm)* distance to object (mm)/(focal length (mm) * image height (pixels))
I can't get a picture now because I don't have the device used :(
Image Analyst
on 3 Dec 2012
The formula is used for thin lenses. Or it can be used for thick lenses if the thickness of the lens if much less than the working distance. So you could use it with fairly good accuracy on a working distance of 10 meters, 100 meters, or infinity. Your accuracy would not be so great with that equation if you had a digital SLR lens that was 5 cm long and you were in macro mode looking at a scene that was only 3 cm away from the lens.
See this article on magnification: http://en.wikipedia.org/wiki/Magnification The magnification is kind of a meaningless concept when you can have your image displayed on different display devices.
I don't like that second equation. How are you going to get the object height in pixels? Let's say you're looking at the sun and it's 1000 pixels high in the image on the CCD sensor. Now, can you tell me that you know how many pixels across the sun is (without knowing the real height of the sun)? You don't know but I'm sure it would be trillions if not more.
Image Analyst
on 3 Dec 2012
It doesn't matter. Just look at the equation. For units you have m = (mm * m) / mm. So look - the mm cancel out! And whatever units you use for the working distance will be the same units that the object height will have. It could be furlongs or parsecs - it doesn't matter. You can use the formula. Personally I wouldn't, but you can. If you just want to know the size of an object in the image, like we've said before, just measure some object of known height. That's how I'd do it.
Carole
on 4 Dec 2012
Edited: Carole
on 20 Dec 2012
thanks
So I can do this:
The resolution of the image is 0.264 mm
D=400 pixels=400*0.264=105.6 mm-->D=105.64/10=10.564 mm
working distance=31 mm
focal length=35 mm
real size=(10.564*31)/35=9.35 mm
Is this correct??? the focal length given by the details of the image http://s17.postimage.org/9zhwkxv67/d_tail2.jpg is correct???
Image Analyst
on 4 Dec 2012
I doubt it. What you're calling the "resolution of the image" is actually the physical size of the pixel. This is typically in the 1 - 9 microns size. I've never heard of a pixel for a digital imaging device being 0.264 mm - that would be one enormous sensor. I've never seen a sensor that's 10 centimeters across - maybe they have something like that for astronomy but it would have more than 400 pixels and so the pixel size would be much less than .264 mm (264 microns).
Carole
on 4 Dec 2012
according to this image http://s8.postimage.org/eea3ekm5x/d_tails1.jpg, the resolution of my image is 96 ppp so 0.264mm*0.264mm according to this link https://www.mathworks.com/matlabcentral/answers/55386-what-s-the-relation-between-a-resolution-and-the-size-of-pixel. Is this correct???
Image Analyst
on 4 Dec 2012
No. You're getting this all confused. In that thread, they're giving the actual resolution at the scene, not on the sensor. And I don't trust what your metadata says unless it's calibrated information inserted directly into the exif by the manufacturer of the instrument.
Walter Roberson
on 4 Dec 2012
96 dpi is a very common resolution for displays, and is seldom the resolution of actual sensors.
Walter Roberson
on 4 Dec 2012
You should assume that the 96 ppp is lying about the resolution of the sensor. 96 dpi is a resolution used for screens
Where are you getting the information about 400 pixels and 31 mm ?
Why is the number of pixels in these images so different from the number of pixels in your earlier thread in which 3997 pixels per meter was being discussed?
Carole
on 4 Dec 2012
Edited: Carole
on 20 Dec 2012
400 pixels is an example.
-->D=351.230559960043
31 mm is found in the features of the device used, 35 mm is found in the details of the image http://s17.postimage.org/9zhwkxv67/d_tail2.jpg
I'm working with other images
what's the solution so?? How I can find:
-Object size on sensor (in mm).
-distance between camera and object (in m). It is 31mm????
-focal length (in mm). It is 35mm??????
Image Analyst
on 4 Dec 2012
Again, I recommend that you don't do any of that. Don't bother with thin lens equations, and don't bother with exif meta data. It seems that it can't be trusted. Just wait until you get the actual instrument in hand and measure something of known dimensions. Then you'll no the absolute truth with no uncertainty.
Walter Roberson
on 4 Dec 2012
I am wondering whether you really need the actual physical size of the objects, or if instead you could just work comparatively? e.g., "This object is 352 units on its major axis." ?
Walter Roberson
on 5 Dec 2012
72 ppp is another common screen density, corresponding exactly to one "point" per pixel. There is a good chance that it is not the real resolution of the source image.
Carole
on 5 Dec 2012
I couldn't understand the differense between this resolution and the resolution of the the source image. One image have different resolutions??????? What does a source image mean?? How can I find of the real resolution of the source image??
Walter Roberson
on 5 Dec 2012
A 640 x 480 image displayed on your screen is going to have a certain physical display size. If the same image were to be displayed on my screen, it would have a different physical display size, because my display is fairly likely a different physical pixel resolution than yours is. It is the same image, but the display might be 72 ppp or 96 ppp or 150 ppp or (e.g., Apple Retina display) 326 ppp. The higher the resolution, the smaller the image displays, if one pixel of display is used for each pixel of the image.
Some display resolution is what your 72 ppp and 96 ppp probably refer to, but these figures do not tell you what the actual resolution of the image is. They do not tell you whether one original pixel is capturing information for 1/10 mm (e.g., mild magnifying glass) or for 10 million parsecs (e.g., telescope). Quoting myself:
Q: In the movie Star Wars, how large is the Imperial Battle Cruiser?
A: About 3 feet long. It just looks huge because of the camera angles and very very careful use of perspective.
Image Analyst
on 5 Dec 2012
Carole, I told you how to figure it out, in my answer above and in practically every comment after that. You measure an object of known size. Plain and simple.
Image Analyst
on 10 Dec 2012
Carole: Please see full demo here: http://www.mathworks.com/matlabcentral/answers/56087#answer_67994
Carole
on 15 Dec 2012
Edited: Carole
on 20 Dec 2012
thanks for the link but any fault by the user will cause a miscalculation. How to calculate the calibration factor without user intervention. How can I measure the real size of object using the graduation and knowing for example that the diameter of object is 100 pixels
Image Analyst
on 15 Dec 2012
There! Oh my gosh! You finally did it! You got a picture with a scale in it! So just run my code - and don't make any faults, whatever that means - and draw a line from the 5 mm line on the scale to the 10 mm line line on the scale, and my code will tell you how many pixels it is, and then you tell it that it is 5 mm, and you will finally get the spatial calibration that you've been after for so long.
Walter Roberson
on 17 Dec 2012
... for this one device.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)