MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Carole
on 3 Dec 2012

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

http://s8.postimage.org/eea3ekm5x/d_tails1.jpg

http://s17.postimage.org/9zhwkxv67/d_tail2.jpg

thanks

*No products are associated with this question.*

Answer by 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?

Show 21 older comments

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.

## 4 Comments

## Walter Roberson

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55569#comment_115098

Is this still to try to find the real size of objects with the dermotoscope ?

## Carole

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55569#comment_115104

yes I'm looking for the formula used :(

## Walter Roberson

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55569#comment_115108

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??

## Carole

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55569#comment_115113

I can't do this because I don't have the device used. I have just the image.