# Using a camera to measure distance

Good afternoon;

Is there a way to measure the distance between two points using a camera (either webcam or Kinect).

I’ve a block of ice which I need to measure the distance from base to top and convert the data into cm.
I plan to make an audio signal with a standing wave that changes with the melting of the ice so I need a measurement that I can work with in an equation.

Any help with this would be greatly appreciated.

Thank you

*** I plan to make an audio signal with a standing wave that changes with the melting of the ice

Nice idea

measure the distance between 2 points with a camera - hmmm it’s possible but here I think this effort is not necessary
just measure it with a ruler or tapeline and then look how many pixel height the cube is

get 2 points - while cube is melting - 01 table - 02 icecubetop

extract the cube from the picture (color, key, infrared)
get a BlackWhite picture (“threshold”)
with the node “contour” or “pipet” you get values for Y (height)

distance between points
i think “contour” has a pin for it
with “pipet” you have to calculate a little bit but more control

greets

As I’m still quite new to VVVV I’m not entirely sure what nodes I’d need for:

“extract the cube from the picture (color, key, infrared)”

Looking at the contour node now which has threshold; I assume that will be fine for the threshold part of it?

Thank you once again.

… if you have a Kinect at your disposal, just take the Depth image and apply a mask on that (to isolate the original, unmelted cube) (Plus some filtering/smoothing, probably). Then, yeah, Contour’s Threshold should be enough to focus on that slice of distance (shade of grey) the cube is at. There’s also a textureFilter ‘Threshold’…

(I have no idea whatsoever how evenly your cube might melt;)

Gah; I did have a Kinect.
After a frustrating chat with Microsoft tech support; I’m told that I have to buy a whole new power supply to change a broken plug pin… Health & safety apparently >_<

Looks like for now I’ll have to try the webcam way, but I hope to get my Kinect up and running shortly.

Got 2 weeks to get this done.

I’ve managed to get a depth image; though I can’t workout how to use contour with it. Nothing seems to go into the inlet of the contour node.

I’m using the KinectDepth subpatch posted in this post:

“Nothing seems to go into the inlet of the contour node.”

Have you checked contour’s helppatch and seen AsVideo (EX9.Texture)?

Managed to get the depth working; I realised that I needed asvideo.

My main issue now is how to convert the data from Contour into real-world data. I thought that the map node would be enough, but unless I’ve something seriously wrong then that doesn’t seem to do it either.

Not sure how to get contour output of 1.28 into 12cm and as the ice melts for it to stay proportionate (0.64 = 6cm).

Thank you for your help so far :)