Results 1 to 2 of 2

Thread: Scanning a layout using photogrammetry

  1. #1
    Join Date
    Apr 2014
    Location
    southeast michigan
    Posts
    992
    Thanks
    419
    Thanked 1,126 Times in 447 Posts
    Mentioned
    30 Post(s)
    Tagged
    0 Thread(s)

    Default Scanning a layout using photogrammetry

    … or, how I lost another day of my life on the black hole that is my laptop.

    One of the best features of Model Railroader is the colorful "overhead view" drawing that they provide for each featured layout. I may have hit on a way to do something similar.
    Mines hi res.jpg
    Attachment 103155

    Back story is once upon a time the company that I worked for had a wonderful CAD program that I used to design my layout. Unfortunately the program did not stand the test of time and I don't even have the files anymore. I've made a lot of changes on the layout and the original printed drawings are woefully obsolete. So I tried creating an up-to-date track plan by taking measurements on the layout and using a freebie CAD program. However, measuring things like arc radii and locating circle centers are things that can't be done once mountains and forests stand in the way, and lets not even talk about easements.

    Gotta be another way, right? Finally found the right magic words to google. There's plenty of stuff out there for iThings with built-in range finders, and lots of expensive equipment available, but I found a program that would a) run on Windows 10, b) use pictures from my camera, and c) cost me nothing but time. I used the freebie handicapped version of 3D Zephyr. https://www.3dflow.net/3df-zephyr-free/ The program is designed to take your photos or movies and turn them into stl files so that you can use a 3D printer to re-create (steal?) something. It is definitely not designed for train layouts but I got decent results right off the bat. The freebie version limits you to 50 photos and you can only export pngs and pdfs.

    The system basically reverse engineers the photos, and if it can identify an object in 3 photos taken from 3 locations, it can triangulate an XYZ position. Its not perfect, but when it works you have a model of your layout that you can rotate and zoom (but oddly not pan) around, which is way way cool to do. Hey, you can even see the surface from underground. This screen shot shows the same model from an orthographic projection.
    Screen iso_cr.jpg
    The blue triangles each correspond to where I took one of the photos, and clicking any of them re-orients your view to match where you were and then overlays the photo to show you how it came up with the 3D geometry. It took information in my SLR's jpg headers to determine the lens and zoom and uses that to do all the reverse engineering. Even the grid is correct - 1 foot. Wow!

    Process is as follows:
    Take pictures of your layout. Move between each picture and overlap them. I think the order matters a lot; there is a "global" option that should have identified things in widely separate pictures, but it mucked things up. I tried a number of things and here are some lessons learned:
    • Focus matters. Anything out of focus is not used and you end up with black areas, especially near the front edge of the layout, when you focus on the middle.
    • It recommends a focal length range. I used a Canon EOS Rebel T2i with a lens set at widest zoom (18mm focal length), auto exposure with no flash, and auto focus. This worked better than my Nikon Coolpix.
    • It helps to take shots pointing at a downward angle - more things are in view that way, it is less likely to underexpose due to bright sky in the background, and more things will be in the depth of field for proper focus.
    • Bright lighting is essential; I had to set up a couple of lamps for the darker areas. Flash seemed to throw things off.
    • Shiny stuff is not good. Repetitive patterns (like railroad ties!) are not good. Creating shadows (of you while you are holding the camera) is not good.
    • I tried placing unique objects on the layout's black areas (see below) to give it some points to bite on, but no joy.
    • 50 pics max.


    Create a directory for your photos and copy them there. Plan to save the 3D Zephyr project file and exported pdfs/pngs there too.

    Fire up 3D Zephyr free. On the Workflow menu create a new project. Accept defaults and import your photos. It then creates a "sparse" point cloud.

    It will tell you which photos it used. If it used them all you are golden. Otherwise try it again with the "deep" option. If it still rejects photos, that means it couldn't find anything to triangulate with - out of focus, lack of overlap, pic too dark, etc. Time to retry taking photos or accept that you aren't going to get the whole layout (it took a lot of tries to get the left end of my layout, and the dark areas in the pics above are obscured behind walls of trees and rock).

    Then create the dense cloud with Category set to Urban and Presets set to Default. This will give you something you can rotate around - awesome - and will show you how bad your black areas are. If you like the coverage, re-generate the dense cloud with Presets set to High Details. On my box with 50 photos this takes over an hour; this is what to save and to export when you are done.

    I failed to find a way to convert the exported pdf into a useful dxf or dwg. Also, if you want to send them $$$, they can create a model from your drone movies...
    Last edited by NtheBasement; 3rd May 2019 at 10:48 PM. Reason: fixed attachment

  2. The Following 6 Users Say Thank You to NtheBasement For This Useful Post:


  3. #2
    Join Date
    May 2010
    Location
    Cincy-whatzit, Ohio
    Posts
    6,661
    Blog Entries
    3
    Thanks
    8,913
    Thanked 8,030 Times in 3,565 Posts
    Mentioned
    198 Post(s)
    Tagged
    0 Thread(s)

    Default

    We use a service like this called Matterport at my architecture office, for getting initial measurements of existing buildings. Essentially it is a panoramic camera mounted on a tripod, you set it up in a room, control it using your tablet or phone, and find a place to hide while it captures the scene. Then you move the camera halfway across the room or to the next doorway and do it again. Each time it checks to see if it has sufficient overlap with a prior shot, and builds the model on the fly. When done, you can send the data off to them to get a usable CAD file, for a fee.

    Good to know there is a "free" method of doing this, too!

    Get yourself a Rail Pass for free travel on the WP&P: wpandp.com
    Could Star Wars: The Last Jedi have been a smarter movie with just one tweak? wpandp.com/how-an-interdictor-could-have-fixed-the-last-jedi/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •