Making a 3D Scanning Dome - Part 1

8th of January 2018

3D Scanning Dome
Spoiler alert! This is what the final dome looks like!

Making a 3D scanner is a tricky project. I learned a lot about the algorithms involved when I built a similar scanner for the University of Leeds sometime ago. Since that time, there have been many advances in the technology and now, one can buy a cheap, laser line scanner for not a lot of money. They all have their problems though. Some are low resolution, others don't capture the surface textures properly. One thing that is key though - you want to control the light. A good friend of mine Dr Hannah Dee over at Aberystwyth University, showed me a project she was working on involving a dome with controllable lights. The theory is, if you want to capture the texture of an object, you need to sample how it responds to different lighting conditions in order to recreate all these bump maps, normal maps, albedo maps etc. I figured this was a good place to start. My initial design didn't include a dome, but who doesn't love a Dome right?

The basic design

I have a few objects in mind that I want to try and capture, so the dome has to be big enough to accommodate these objects. I made a rough estimate of the size the dome would need to be. I've still not found calculator and hub design that I trust I have to say! Not sure why, but although it's easy enough to generate the required strut lengths, the problems with geodesic domes all come down to the hub connectors. In the end, I decided to modify a design a found in thingiverse. As this design uses the wrong units, I converted it to good and correct metric units, using the program Design Spark Mechanical. This program is a little easier for me than Autodesk or solidworks, if I'm just doing minor corrections. I altered the hubs so they would accept 5mm thick acrylic.

Thanks to another friend, Dr Julie Freeman I managed to get the hubs 3D printed (using a proper 3D printer and not a glue-gun on rails!) and laser cut the struts. I added holes along the struts so that I could bolt on any things I'd forgotten down the line. The prints and cuts came out beautifully I think!

Putting it together

Building My Dome
It's quite good fun putting a dome together! I have to say though, I'm glad it's only a small dome, and not one made out of steel tubing!

Despite how good the printed parts were, issues with the design did begin to creep in. The support material in the 3D printer is a waxy-like substance that you need to clean off with a special pressure washer. This is loads of fun I have to say, but the process is not perfect. There are lots of annoying left-over residues inside the slots for the struts. This means the fit was not always perfect and in some cases, the thin 5x5mm strut end would snap. I think a better locking mechanism will be needed next time, as oppose to a push/snap fit one. Top tip people - always make spares!

Cameras

The first version of the dome was inspired by my previous attempts at a scanner. I wondered if it was possible to cover the dome in cheap, yet high resolution webcameras, instead of using a single SLR or equivalent? This would cut down on the time to take all the snaps required. My camera of choice is the Logitech C910. The reason for this is that I'd had a few lying around already from the previous gig and so buying a few more wouldn't increase the costs too much. The resolution is acceptable and they can be controlled via UVC under Linux.

This latter point is quite useful! It's very important to be able to programmatically control the white-balance, resolution and more critically, the focus. You can do all that with a variety of programs, my favourite being GUVCView. This program can be called from the command line with a list of settings, held in an XML file. So once you've played with the settings you want, you can save them out and use them again really easily.

This page has a good review of the field of view from both cameras. I can summarise the basic stats as follows:


Max res 2592 x 1944

Focus distances in cm with the non-continuous steps:
   255 / 3.5
   238 / 3.8
   221 / 4
   204 / 4.3
   187 / 5.3
   170 / 6.4
   153 / 8
   136 / 10.5
   119 / 15
   102 / 25
   85 / 40
   68 / 51

Roughly a 3mm aperture. Focal length is 4.3mm. This would give an f value of 1.43 (1.4 seems about right I guess).

Connection Type Corded USB
USB Type    High Speed USB 2.0
USB VID_PID VID_046D&PID_0821
UVC Support Yes
Microphone  Yes
Microphone Type Stereo
Lens and Sensor Type    Glass
Focus Type  Auto
Optical Resolution  5MP True
Diagonal Field of View (FOV)    83°
Focal Length    4.3 mm
Image Capture (4:3 SD)  640x480, 1.2 MP, 5.0 MP, 10 MP
Image Capture (16:9 W)  360p, 480p, 720p, 1080p
Video Capture (4:3 SD)  320x240, 640x480, 1600x1200 2MP
Video Capture (16:9 W)  360p, 480p, 720p, 1080p
Frame Rate (max)    30fps @ 640x480
Right Light Right Light 2
Video Effects (VFX) N/A
Buttons N/A
Indicator Lights (LED)  Activity/Power
Privacy Shade   Yes (Software)
Tripod Mounting Option  No
Universal Clip Adjustability (range)    0° to 180° (Adjustable)
Cable Length    5 Feet or 1.5 Meters

The biggest problem with the C910 is it's mounting. It's a real pain to do anything with unless you are putting it at the top of a monitor. In my initial tests, I just cable-tied a few of them to the support struts.

You need quite a few USB controllers to take care of 8 of these cameras (I had managed to buy 8 - the same number I used in my previous scanner). In the end, rather than buy a couple of controller cards, I decided to get some cheap USB powered hubs and drive the cameras individually, taking a single snap-shot each.

Rather than post the code here, you can view it on github in the scanner directory. I've included a lot of older code in there, which I will need to filter out but the majority of it works fine. One thing I noticed is that when taking a screenshot, one needs to access the camera a few times because the focus, and indeed the white-balance, isn't immediately set correctly. If you look further down int the main function you'll see what I mean. This program outputs raw bitmaps, as it's advisable to avoid compression artefacts when creating 3D scans from images.

The LEDs

Again, scavenging from another project, I had a load of TM1809 LED strips lying around. I won't lie, these things are mostly terrible! I find them to be just a little too flakey. Sometimes, they'll stop working or one LED will be the wrong colour, or something else goes wrong. However, I don't quite need perfect LEDs for this project, just some illumination.

Each strip of 3 LEDs fits quite nicely on a single strut of the dome. This means cutting, soldering and attaching around 50 such strips! Only thing to do is to brew up several cups of tea and get cracking!

Assembling the LEDS

Controlling the lights requires some sort of micro-controller. I've used the Arduino in the past, with the FastLed library so I figured I'd just use that again

P1100501.jpg
LEDs attached and shinning at full brightness. Note how blue it looks.

The next steps

With the dome all setup and the LEDs and cameras in place, I decided to take a few initial tests with the camera. Using agisoft photoscan I took several photos around a couple of test objects. However, I the results weren't all that great. The main problem, I was told, was to do with the busy background. It was suggested to me that I try and mask out the background, possibly using a combination of the manual masking modes in the program and an actual diffuser screen inside the dome. In the next post, I'll describe how I built such a screen and where I went next.