If I have a photograph of a rectangular object whose image recedes with perspective, is it possible to work out the scale of measurements along that object?

For example: I have a photograph of a (metric) ruler.

The ruler is graduated in centimetres as shown, 30 cms.

Is it possible to work out the distance between each centimetre?

The screenshot shows the photograph.

The representation on the Picture Plane shows the nearest edge of the ruler to be 50mm and the farthest edge to be 15mm. By measuring the photo, I see that the distance between 0 and 1 is 7.5mm and the distance between 27 and 28 is 0.9mm.

Is there a way to get these results from a formula?

It doesn't need to be 100% accurate: it's for photometric software I'm writing, so it's only going to be used as a rough guide. c8373cbf43edb469fffe0c8d8b5a3acd

Just google example Success!

I had already found that page on google, but didn't find it particularly helpful.

No matter, I think I've worked it out without your help anyway.

Will post my solution when I have it working.

What I did was this:

c1f0b3e2277e6bb30bd81950f0c37cc6

I drew the rectangle ABCD in perspective using the measurements given above. I then drew E-F which is 7.5mm from A-B which represents the graduation at 1cm. I could have chosen any distance but have decided to use the value from the photograph.

I then drew a line from B through the mid point of E-F.

21b78d0aa4e9a360144d134ba86d1713

I extended this line to intersect the line A-D. I then drew the line G-H.

1788bc7b1edc069b81a1839eebfb72d3

I repeated this until I had all the divisions marking the graduation of the ruler.

48fe016f22e94d83a4dc331968de0585

commented: Awesome! Kudos for posting the solution for others. +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.