Is this formula correct??
3 次查看(过去 30 天)
显示 更早的评论
Carole
2012-12-3
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 个评论
Walter Roberson
2012-12-3
Is this still to try to find the real size of objects with the dermotoscope ?
Walter Roberson
2012-12-3
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??
回答(1 个)
Image Analyst
2012-12-3
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 个评论
Carole
2012-12-3
编辑:Carole
2013-1-3
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
2012-12-3
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.
Carole
2012-12-3
I can't understand the difference between thin lenses and thick lenses. How I can know if I can use this formula or no?? The distance between camera and object in the first formula should be in m or in mm??
Image Analyst
2012-12-3
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
2012-12-4
编辑:Carole
2012-12-20
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
2012-12-4
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
2012-12-4
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
2012-12-4
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
2012-12-4
96 dpi is a very common resolution for displays, and is seldom the resolution of actual sensors.
Carole
2012-12-4
I'm getting this all confused because I don't have much knowledge in this field :( So what are the missing parameters??
size of object: 400 pixels
working distance: 31 mm
Walter Roberson
2012-12-4
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
2012-12-4
编辑:Carole
2012-12-20
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
2012-12-4
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
2012-12-4
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
2012-12-5
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
2012-12-5
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
2012-12-5
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
2012-12-5
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
2012-12-10
Carole: Please see full demo here: http://www.mathworks.com/matlabcentral/answers/56087#answer_67994
Carole
2012-12-15
编辑:Carole
2012-12-20
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
2012-12-15
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)