2D Room Mapping With a Laser and a Webcam

2014-01-29-21-02-40

[Shane Ormonde] recently learned how to measure distance using just a webcam, a laser, and everyone’s favorite math — trigonometry. Since then he’s thrown the device onto a stepper motor, and now has a clever 2D room mapping machine.

He learned how to create the webcam laser range finder from [Todd Danko], a project we featured 7 years ago! It’s a pretty simple concept. The camera and laser are placed parallel to each other at a known distance, axis-to-axis. On the computer, a python script (using the OpenCV library) searches the image for the brightest point (the laser). The closer the brightest point is to the center of the image, the farther the object. Counting pixels from the center of the image to the laser point allows you to calculate an angle, which can then be used to calculate the distance to the object — of course, this needs to be calibrated to be at all accurate. [Shane] does a great job explaining all of this in one of his past posts, building the webcam laser rangefinder.

From there it was just a matter of slapping the rangefinder onto a stepper motor, driving it with a small PIC, and running the calculations on the fly! His results are fairly impressive.

Comments

  1. T0x1c says:

    You could add a dispersion lens to increase the dot size, this might yield greater resolution.

  2. neon22 says:

    We’re all watching the red dot travelling along a wall in the dark. Congratulations Sir ! I am now officially a Cat !

  3. neon22 says:

    Try replacing the laser pointer optics with line optics (or use a cheap laser level tool from economy hardware store). This will make a vertical line instead of a dot.
    Now you can use your code to check all the pixels in an entire vertical stripe instead of a single dot. and get a lot more vertical res.

    For fun and entertainment – the IR filter on your webcam could be removed but you could add a green laser instead – also shot through same optics (or directly adjacent to red line, or in same position but switched on and off on alternate frame times).
    Or a blue laser or whatever – the point being that surfaces that don’t reflect red well might reflect another colour better.

    Great work. and in Python too. Yay Python !

  4. justice099 says:

    One step closer to those little balls in Prometheus that map out the caves.

    The next step should be a script for Sketchup that builds the room from the data.

  5. ftkalcevic says:

    I did this with a atxmega and TSL1401-DB Linescan Camera Module. I’ve gotten over 500 measurements per second. The limiting factor is the scanners light sensitivity.

  6. justice099 says:

    I have always had this idea of some type of system that simply senses its surroundings. Have you ever noticed that you can feel when something is behind you? Even things you can’t see, you have a sense (as inaccurate as it is) of your surroundings. If you walk in the dark, you can sense that you are coming upon a wall. Or when someone is standing behind you suddenly.

    The effect I think is changes in air pressure. Like the Archimede’s principle. Air is a fluid, and anything within it will displace it which creates a directional force. I believe we can sense this pressure change on our skin.

    I haven’t quite figured out how to build something like this, but in my head I forsee something similar to an arrangement of speakers used as microphones. Obviously that should be able to sense pressure changes due to a disturbance in the fluid air, but if the measurement device is stationary and the objects in the room are stationary, it seems like it would measure nothing.

    Don’t laugh, but I’ve always named it acoustical mass displacement sensing.

    Any thoughts on this?

    • justice099 says:

      Incomplete thought. In order to sense things, one of the parts in the system will have to move. I wonder if simply vibrating the sensing instrument (and then filtering that vibration out) would be enough.

  7. the gambler says:

    reading the comments made me laugh a bit, not at any of the ideas but the outcome and possible news headlines…

    “NSA caught snooping on building mapping robots”

  8. vonskippy says:

    It’d be cooler if he used a laser and a shark.

  9. Matthew says:

    I’d like to point out another cool hack in this picture: The use of zip ties and metal scrap to prevent a pair of helping hands from tipping over. Why didn’t I think of that?

  10. Jrd says:

    Very cool!
    And good idea with the verical line,eventualy,you may end up with the kinect:-)

  11. batchloaf says:

    Reblogged this on ad hocumentation • n. fast, instinctive documentation of ideas and solutions. and commented:
    Shane Ormonde, from DIT programme DT009, also recently featured on hackaday.com. His project is a lovely adaptation of a webcam laser range finder (originally by Todd Danko) to scan and map the shape of a room. It’s an ingenious piece of work – I hope to try this out myself soon!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,260 other followers