cross-posted from @[email protected]: https://lemmy.world/post/23787115

I’ve managed to do reverse engineering of circuit boards using GIMP and rough alignment of layers using images like the one pictured. I want to use images to reverse engineer parts in CAD, but the minor lens distortion of a camera on a phone at ~20cm high on top of a stack of objects to keep it eyeballed flat is not enough. The result is off in multiple planes. There are minor errors in my curves in the transparent CAD part pictured, but the hole pattern is correct. The picture has been calibrated to 20mm against the ruler. Any suggestions on how to make this usable for replicating the ellipse that crosses the holes ±0.05mm?

  • @CrayonRosary
    link
    English
    9
    edit-2
    5 days ago

    The easiest option is to take a photo from very far away with a long focal length lens. The longer the better. At least a 200mm focal length. You need a real camera and lens for that, and they aren’t free. And you can’t always get far away from your subject.

    Other people mentioned a flatbed scanner. Excellent choice.

    When I’ve needed to do this for something that didn’t fit on a flatbed scanner, I’ve used photogrammetry. Bonus is that you probably already have everything you need.

    Requirements:

    1. Any camera. A phone is fine.
    2. A computer with a GPU. An NVidia GPU is better for some software, but maybe times have changed, and this likely only affects the speed.
    3. Photogrammetry software. I used 3D Zephyr which has a free version limited to 20 input photos, and I’ve also tried Meshroom, which is FOSS, but I don’t remember if it worked well for me. (Thanks @[email protected] !)
    4. A ruler or something you can attach to the object for scale. I’ve often used masking tape with lines at a known distance, the father apart the better.

    Overall process:

    1. Tape a ruler to the object for scale.
    2. Take a bunch of photos from different angles.
    3. Load them into the photogrammetry software and let it do it’s thing.
    4. Take the resultant textured object into Blender and rotate it until it’s perfectly parallel to a coordinate plane. (This is actually not easy [1])
    5. Position the camera perpendicular to that plane and change it to orthographic rendering.
    6. Render an image.
    7. Use the image as a canvas in my CAD software, being sure to calibrate its size using the ruler contained in the image from step 1.
    8. Trace the image.

    This allowed me to measure the position of a whole bunch of really oddly placed screw holes on a 30x30" section of a wall with <1mm accuracy, allowing me to laser cut a thin sheet of plywood having holes in those same locations.


    1. Your object will be imported in a random orientaion, and your resultant mesh won’t have anything actually flat on it. You can’t just pick one poly of the mesh and say “make this poly parallel to my intended plane”. It will be rotated in some random way. Especially if the object is something random and bumpy like a brick wall. Even being off by a couple degrees ruins the result. I had to create a cube the size of my object and intersect it with my object, moving and rotating the cube until it visually appeared to be parallel to my object. It was like floating my object in water (the cube) until the surface of the water filled the nooks and crannies of my object more-or-less equally. Then I noted the rotation of that cube and applied the same negative rotation to my object. ↩︎

    • Rentlar
      link
      fedilink
      15 days ago

      I think the software you were thinking of is 3D zephyr.

      The best FOSS one imo is Meshroom. One tip when using that is to stop the process after the Structure from Motion process, add a bounding box around the main subject area so that there is less background modeled at the end.

      • @CrayonRosary
        link
        English
        2
        edit-2
        5 days ago

        Yes, that was the one. I tried Meshroom as well, at a later date. I forget if it was a success or not.

        Good tip, though! I have often had to clean up meshes after the fact using something like Meshmixer. (I am in no way skilled in Blender.)