# Measurement within known diameter tube

Hi All,

I am having trouble working out how to solve the following problem:

I am acquiring images from a camera placed within a tube of known fixed diameter, I am trying to implement an interface whereby a user can draw a line between 2 points and the real world measurement should be calculated, this can be in any orientation they like.

My first approach was to use trig, But then I thought this would be erroneous due to perspective distortion?

Could anybody shed any light on this?

Thanks, Digby

**Update**

Here is a screenshot. The mesh is moveable so I can select the vanishing point.

Can you attach a quick image sketch of your setup?

So what exactly do you want to measure?

I would like to be able to draw a straight line and calculate the length of it in mm. Is this possible with the only known parameter being the diameter of the tube?

The straight line being the length of the tube or any random straight line?

Principally I would like to know how to calculate the length of a line running parallel to the length of the tube but ideally any random straight line.

Running parallel to the tube is do-able. I believe you were on the right track with the trig, provided you also know the camera's focal length. To improve accuracy you'll want to calibrate your camera and remove lens physical radial distortion. And also, it helps to the align the camera center to the true center of the tube as well. Out of curiosity, what is the application?

Recently bought a raspberry pi and was messing around trying to think of an application. Then I had a blockage in a drain pipe and wanted to know where it was. Nothing exciting really but is frustrating me now that I can't do it.

When reading up the only formulae that I can find you need to know real life object size to get the distance.