
Background information
How difficult is it to build a 3D scanner?
by Kevin Hofer
I have built myself a 3D scanner. Despite the hair-raisingly sparse instructions, the thing works. Until I want to merge the images into a three-dimensional model.
It was a huge effort to build the 3D scanner. To make matters worse, after the work was done, there wasn't even any praise, but scolding from user Anonymous:
$ for i in *,jpg; do convert $i $i:s/jpg/png; done
Und wer editiert oder pastet bitteschön Code in Google Docs?]]
Half as bad. I'm not a software crack - thanks for the tip with ImageMagick. As a reminder, I gave up last time when Meshroom - the software that is supposed to convert my images into a three-dimensional image - spat out an error message.
"Not a PNG file" it said and I'd had enough for the time being. Two days later, I had enough time to get back to the project.
Before I can start, I have to make the images readable for Meshroom. If I open one of the Brio bridge images with Notepad++ - Windows' own editor also works - the first four characters are "ÿØÿà". This means that it is a JPG file. However, when I display the properties of the files in Windows Explorer, they are labelled as PNG. Something is wrong here. Meshroom also notices this. Something must have gone wrong with the labelling when transferring the files from the smartphone to the computer. Unfortunately, simply changing the file suffix to JPG doesn't solve the problem: Meshroom still incorrectly assumes that the file is a PNG. That's why I convert the files from JPG to JPG using IrfanView. Annoying, but because Windows doesn't realise that these are JPG files, there's no other way of doing it.
I just have to click on Start and Meshroom calculates. And it calculates and calculates and calculates. Holy shit. I think I've found a new benchmark for CPU reviews: All 16 cores of the Ryzen 9 3950X are running at full speed. At some point, progress stalls and the bar turns red. There must be an error somewhere in the image material. I decide to fire up the 3D scanner again, place a slightly simpler model on the platform and try with fewer than 180 images.
With Meshroom, the quality of the image sources is the be-all and end-all. As the smartphone camera refocusses each time, the same area is not always in focus. This may have brought Meshroom to its knees.
I'll try it with a model solar car. To make Meshroom calculate faster, I only take 60 images instead of 180 as in the Brio bridge attempt. Once again, I have to take the diversions via IrfanView and convert the images to JPG. I import them into Meshroom and click on Start. Cool, something happens and Meshroom creates a 3D model. Its quality leaves a lot to be desired.
Meshroom can only use seven of the 60 images. The programme therefore only creates a three-dimensional model from one side. I wonder what went wrong? In any case, the model created is unusable. Perhaps it needs more light and perhaps the blue colour of the platform is not an optimal background.
I stick a white film on the platform and put a lamp there to illuminate my project better. I'm also only taking 20 pictures now. If it works out like this, I can always try again with more pictures.
As before, I first have to convert the images in IrfanView. Then I load them into Meshroom and let the programme do the calculations. Unfortunately, it gives me an error message with every image. Nothing, I'll try again. Maybe it was because I'm too far away from the model solar car with the camera?
For comparison, I take another look at the video of QLRO, the designer of the 3D scanner. He is much closer with his camera than I am and he works with a black background. I try that too. Again, I only take 20 pictures. Still the same error. Is it because I'm taking too few pictures? The error message says: "No valid initial pair found automatically".
I google the error message. According to various forums, there may be two reasons why my endeavour is not successful. Firstly, I may have taken too few pictures and secondly, the lamp may be interfering as my model is very reflective. All over again, this time with 100 pictures and without a lamp. Do I still need to mention the tedious step with IrfanView?
Cool, now Meshroom is struggling with the images. It takes over 28 minutes for the programme to finish its calculations. Now the whole thing looks much more reasonable.
Because the model is reflective, I still have some unevenness. The shadow cast by the model solar car also didn't help when creating the model. I could fix that in another programme like Maya or Blender. The excess material around the scanned model solar car could also be removed in this way.
I'm not reworking the model solar car. I don't know what I'm going to do with it when I'm finished. I have no experience in Maya or Blender. I'm sure it will take me some time to familiarise myself with the programme. I'm not a software genius. I'll save that for a specific project - I'm sure I'll come up with something.
Overall, I think my project is a success. The scanner works and the scans are - with a little practice - quite acceptable. I'm sure I can do even better with more practice. I'll probably have to rework it anyway. I'll keep at it.
From big data to big brother, Cyborgs to Sci-Fi. All aspects of technology and society fascinate me.