DIY Photography

Hacking Photography - one Picture at a time

  • News
  • Inspiration
  • Reviews
  • Tutorials
  • DIY
  • Gear
Search

Submit A Story

3D scanning like a pro

May 8, 2017 by Saulius Lukse Leave a Comment

  • Share
  • Tweet
  • Flipboard
  • WhatsApp

Almost any sensor yields more interesting results if mounted on a moving platform. Remember scanning thermometer? It’s time to mount TOF LIDAR (Time Of Flight / Light Imaging, Detection, And Ranging) on two precision rotary stages arranged for pan and tilt operation. Rig provides real-time position data along with distance to an obstacle. Using simple math we can calculate the position in Cartesian coordinate system. Data is collected point-by- point to reconstruct 3D object model.

Used parts

I have been looking for LIDAR for a while and decided to use Garmin as an affordable distance sensor, so bought one for a spin.

  • Modular motorized rotary stage Kurokesu RSA1
  • Motion controller Kurokesu SCA1
  • Arduino nano (Atmega 328p) with Garmin LIDAR-Lite 3
  • Laptop computer
  • Battery pack for controller

Results

Garmin LIDAR outputs data at up to 500 measurements a second which is way faster than the thermal sensor, yet it takes about 15 minutes to scan full sphere yielding true scale 1-2M point cloud. No stitching, no lengthy post processing! And the result is spectacular.

Animated GIF for better depth perception. Calculated point cloud normals and colorized according to their vector direction. Click for better quality on Youtube.

This is another fast scan with higher rotation speed. Result is 300K point cloud.

4.7M point cloud room view from above with colors removed. From this picture, it’s possible to see that distance measurement could be more precise and laser beam angle could be narrower. Density is pretty even which indicates nice rotary stage performance and correct calculation.

Depth map colorized as heat map colors and fixed black pixels. This imaging is useful for fast quality inspection.

Unfortunately, this particular LIDAR is not quite suitable for outdoor mapping. The laser is too weak even in dusk and measurement rate drops, therefore scanning speed has to be reduced and it would take hours to cover a longer range. Click for better quality on Youtube.

Laser barely reaches 4’th floor, therefore making it not suitable for long range outdoor operation.

Software

I have written set of Python scripts to make scans like this. As release is still pending, will briefly describe what they do:

Scan

  1. Establish communication to sensor and motion controller
  2. Initialize motion platform (homing, zeroing)
  3. Start motion at specified speed and tilt incline angle. Rotation count is calculated automatically. Platform rotates at constant angular speed gradually changing tilt angle
  4. Platform position data is being recorded into file along with timestamp
  5. Sensor data is being recorded into separate file along with timestamp
  6. After scan is complete platform moves home and computer beeps to indicate end of scan

Fill dead pixels

  1. Load bitmap picture (generated as intermediate result by aggregate script)
  2. Find black pixels
  3. For each black pixel find neighbouring pixels, average their color and fill black pixel with new value
  4. Save file as new bitmap picture

Finding of black pixels can be done by brute force but it will take ages. Speed up can be done by using numpy functionality:

pixels = np.asarray(img_gray)
coordList = np.where(pixels != 0)
coordinates = zip(coordList[0], coordList[1])

Aggregate

  1. Load previously saved files (position data and sensor values)
  2. For each sensor value interpolate motor position from two nearest points (aligned by timestamp)
  3. Convert depth data to color and coordinates into 2D picture for fast preview (or final picture in case of thermometer)
  4. Convert angle and measured depth to Cartesian coordinate system and save each pixel to *.xyz file.

Pan/tilt/distance conversion to x,y,z is as simple as these formulas:

x = r * sin(th) * cos(tv)
y = r * sin(th) * sin(tv)
z = r * cos(th)

That’s it. Now point cloud file can be opened with preferred 3D manipulation program like MeshLab

Improvements and notes

The main part to be improved is LIDAR. Faster acquisition rate, smaller beam expansion, better precision and greater power is required.

Motion platform operation is quiet, smooth, fast and precise.Though with faster laser fast axis might be limiting factor.

Draft software lacks real-time preview of what’s happening, but that’s easy to update.

One slip-ring is damaged (or bad by design) and sometimes I2C communication is interrupted – added watchdog protection to restore LIDAR operation.

One more major update could be getting rid of the laptop, instead using single board computer with tablet or smartphone connected over WiFi.

About the Author

Saulius Lukšė is an engineer with a demonstrated history of working in the wireless industry. He is a founder of Kurokesu, an e-shop where he sells his designs and solutions like touch probe, Raspberry Pi case, C920 webcam rework kit, high sensitivity USB camera and others. You can check out his products on his website and look him up on Facebook and Twitter. This article was also published here and shared with permission.

FIND THIS INTERESTING? SHARE IT WITH YOUR FRIENDS!

  • Share
  • Tweet
  • Flipboard
  • WhatsApp

Related posts:

Apple Announces iPad Pro; MS Surface Pro Users Confused By Apple’s Use Of The Words “Pro”, “New” Automating image capture for 3D scanning through photogrammetry Bellus3D will launch a fast and cheap 3D face scanning camera for mobile devices Automating scanning film with the help of Lego, a Raspberry Pi and a little machine learning

Filed Under: Tutorials Tagged With: 3d, 3D scanning, Saulius Lukse

« Three tips for posing your non professional friends and family
How to make 3 point portrait lighting setup on a budget »

Submit A Story

Get our FREE Lighting Book

DIYP lighting book cover

* download requires newsletter signup
DIYPhotography

Recent Comments

Free Resources

Advanced lighting book

Recent Posts

  • Sony almost joined team Micro Four Thirds in 2008
  • Photographer’s Block? Here’s how to get out of a creative rut
  • Zhiyun MOLUS G60 & X100 LED lights are tiny-tiny powerful LEDs
  • Three new full-frame and APS-C Sigma lenses coming soon
  • Sony launches DSC-HX99 retinal projection kit for the visually impaired

Alex Baker is a portrait and lifestyle driven photographer based in Valencia, Spain. She works on a range of projects from commercial to fine art and has had work featured in publications such as The Daily Mail, Conde Nast Traveller and El Mundo, and has exhibited work across Europe

Dave Williams is an accomplished travel photographer, writer, and best-selling author from the UK. He is also a photography educator and published Aurora expert. Dave has traveled extensively in recent years, capturing stunning images from around the world in a modified van. His work has been featured in various publications and he has worked with notable brands such as Skoda, EE, Boeing, Huawei, Microsoft, BMW, Conde Nast, Electronic Arts, Discovery, BBC, The Guardian, ESPN, NBC, and many others.

John Aldred is a photographer with over 20 years of experience in the portrait and commercial worlds. He is based in Scotland and has been an early adopter - and occasional beta tester - of almost every digital imaging technology in that time. As well as his creative visual work, John uses 3D printing, electronics and programming to create his own photography and filmmaking tools and consults for a number of brands across the industry.

Dunja Djudjic is a multi-talented artist based in Novi Sad, Serbia. With 15 years of experience as a photographer, she specializes in capturing the beauty of nature, travel, and fine art. In addition to her photography, Dunja also expresses her creativity through writing, embroidery, and jewelry making.

Copyright © DIYPhotography 2006 - 2023 | About | Contact | Advertise | Write for DIYP | Full Disclosure | Privacy Policy