# 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.

edit retag close merge delete

Can you attach a quick image sketch of your setup?

( 2014-01-11 19:06:48 -0500 )edit

So what exactly do you want to measure?

( 2014-01-15 07:17:00 -0500 )edit

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?

( 2014-01-15 09:02:57 -0500 )edit

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

( 2014-01-15 18:01:18 -0500 )edit

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.

( 2014-01-16 02:41:01 -0500 )edit

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?

( 2014-01-16 03:32:50 -0500 )edit

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.

( 2014-01-16 04:11:58 -0500 )edit

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

( 2014-01-16 04:14:01 -0500 )edit

Sort by ยป oldest newest most voted

This is what I had in mind. This a side view cut out, with +y direction pointing up. The diagram might look a bit intimidating but it's basic high school trig. I made an assumption about the camera's position, in this case it is inside the tube. The accuracy gets worse as L gets longer because "A" undergoes very small change.

more

1

( 2014-01-16 06:03:10 -0500 )edit

What units do you use for y and for height. Is height the image height in pixels?

( 2014-01-16 06:22:01 -0500 )edit

Yep they are in pixels.

( 2014-01-16 06:29:44 -0500 )edit

Official site

GitHub

Wiki

Documentation

## Stats

Seen: 414 times

Last updated: Jan 16 '14