Ask Your Question

Measurement within known diameter tube

asked 2014-01-09 10:51:36 -0500

DigbySwift gravatar image

updated 2014-01-15 06:31:01 -0500

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


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

image description

edit retag flag offensive close merge delete


Can you attach a quick image sketch of your setup?

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

So what exactly do you want to measure?

Nghia gravatar imageNghia ( 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?

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

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

Nghia gravatar imageNghia ( 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.

DigbySwift gravatar imageDigbySwift ( 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?

Nghia gravatar imageNghia ( 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.

DigbySwift gravatar imageDigbySwift ( 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.

DigbySwift gravatar imageDigbySwift ( 2014-01-16 04:14:01 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-01-16 05:42:25 -0500

Nghia gravatar image

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.

image description

edit flag offensive delete link more



wow thanks for your effort.

DigbySwift gravatar imageDigbySwift ( 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?

DigbySwift gravatar imageDigbySwift ( 2014-01-16 06:22:01 -0500 )edit

Yep they are in pixels.

Nghia gravatar imageNghia ( 2014-01-16 06:29:44 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-01-09 10:51:36 -0500

Seen: 445 times

Last updated: Jan 16 '14