Raúl Otaño
Raúl Otaño

Reputation: 4760

Pixel-Milimeter Proportion

I have a digital image, and I want to make some calculation based on distances on it. So I need to get the Milimeter/Pixel proportion. What I'm doing right now, is to mark two points wich I know the real world distance, to calculate the Euclidian distance between them, and than obtain the proportion. The question is, Only with two points can I make the correct Milimeter/Pixel's proportion, or do I need to use 4 points, 2 for the X-Axis and 2 for Y-axis?

Upvotes: 0

Views: 197

Answers (2)

niculare
niculare

Reputation: 3687

If you know the distance between the points A and B measured on the picture(say in inch) and you also know the number of pixels between the points, you can easily calculate the pixels/inch ratio by dividing <pixels>/<inches>.

I suggest to take the points on the picture such that the line which intersects them is either horizontal either vertical such that calculations do not have errors taking into account the pixels have a rectangular form.

Upvotes: 1

Russell Zahniser
Russell Zahniser

Reputation: 16364

If your image is of a flat surface and the camera direction is perpendicular to that surface, then your scale factor should be the same in both directions.

If your image is of a flat surface, but it is tilted relative to the camera, then marking out a rectangle of known proportions on that surface would allow you to compute a perspective transform. (See for example this question)

If your image is of a 3D scene, then of course there is no way in general to convert pixels to distances.

Upvotes: 1

Related Questions