Coder Social home page Coder Social logo

3d_scanning's Introduction

macOS 3D Scanning

Ways to do 3D scanning on a Mac for free. It has to be free because you've spent all you have on that Mac. :o)

I put this up here because, as someone who just wanted to try out 3D scanning out of curiosity, I spent a disproportionate of time searching in vain for 3D scanning tools that are (a) available for macOS, (b) easy to use without a lot of learning, (c) free. Everything ready-to-use that I came across is either discontinued or requires extra hardware or a different operating system.

But the stuff here works! :)

Photogrammetry

I'd say that this is the most user-friendly free solution I could find. Except for the little bit of initial shell wizardry, it is a relatively self-contained pipeline and comes close to what I would call a one-click (or one-command) process.

The directory photogrammetry contains a working open source solution to create 3D scans from photos on a Mac (that does not have CUDA). It is based on Peter Falkingham's extensive tests, but adapted for macOS. It has been tested on macOS 10.13 High Sierra and contains the following files:

  • install_mac.sh: Installation script for the necessary open source software openMVG and openMVS.
  • process_directory.sh: Script to analyze a folder with images and create a 3D mesh (.obj file).
  • There are also some example files that show the input and output of scanning a small frog-related trinket.

Installation:

  1. Install homebrew (A tool to install packages on macOS in a Linux-like fashion. This will also install XCode command line tools if necessary.)
  2. Download install_mac.sh and process_directory.sh and put them into a folder you created specifically for 3D scanning (e.g. 3D-Scanning).
  3. In the Terminal application, navigate to this folder (type cd and then drag the folder from Finder into the Terminal window, and press Enter)
  4. Run the command chmod u+x *.sh (and as for all commands, press Enter)
  5. Run the command ./install_mac.sh (mind the ./ at the beginning). This will install all needed components.

Usage:

  1. Take suitable photos of your object. There are many guides on how to do this properly. In a nutshell,
    • you need a good camera with a lot of details (modern smartphones are usually sufficient). RAW format would be great, but big (multi-MB) JPEG might be sufficient as well.
    • You want good lighting,
    • you need a lot of photos (50+),
    • the object has to be perfectly in focus in all pictures (easy to misjudge when you are too close to small objects),
    • the object must not be moved nor must there be lighting variation (turn off/lock your camera's white balance and automatic exposure),
    • there must not be any glare/reflection at all (baby powder is useful for making glossy surfaces matte),
    • have as little irrelevant non-object details in the picture as possible -- if there are, you might have to edit them out in a photo editing software, or, better still, apply the void technique.
  2. Save your photos in a subfolder of your 3D-Scanning folder, e.g. Banana (no spaces allowed).
  3. In the 3D-Scanning folder in Terminal, run the command ./process_directory.sh Banana.
  4. The result will be placed in the 3D-Scanning folder, in this case the file will be called `Banana.obj'.
  5. Fix and post-process the resulting model in a software like Meshmixer or Blender (for the frog example, I chose Meshmixer. I am not a monster).

Notes and caveats:

  • Reconstruction of the 3D object is a multi-hour process (I saw anything between 2 and 6 hours). The file process_directory.sh contains some rough indications of how long which steps might take. I usually run this process overnight.
  • If the process finishes suspiciously fast, something is wrong. This is because the underlying tools don't show error messages if they are missing files. I also had the situation that my photos were just too bad for it to actually reconstruct anything, and it just claimed that it was finished, but there was no output file. I then re-took the pictures, paying more attention to focus, quality and the absence of glare/specular reflection. Then it worked nicely! See the provided example.
  • If your Mac is not very powerful, and particularly if does not have a lot (e.g. 16GB) of RAM, it is advisable to close all other applications and not use the computer, in order to free up processing power and particularly to free up RAM. Otherwise, macOS will constantly swap data between RAM and SSD, and the process slows by an order of magnitude (think 30 hours instead of 3 hours).
  • If you do have a CUDA-able Mac, you should instead use CUDA-able versions of the underlying tools, which speeds up the process by an order of magnitude. If you don't know what CUDA is, you probably can't use it anyway, and should be fine with the scripts here.
  • I'm aware that there are other solutions like smartphone apps where you put the object on a sheet with markers, or using newer smartphones with depth sensors, etc. But I did not like the performance of the former, and don't have the latter. :)

The example object being covered with baby powder

3d_scanning's People

Contributors

schuderer avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

3d_scanning's Issues

Install fails

Install fails on new MacBook Pro running Mac OS 12.4 w/Xcode 13.4. Reports too many errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.