{"id":17145364,"url":"https://github.com/alyssaq/3dreconstruction","last_synced_at":"2025-04-05T18:08:58.170Z","repository":{"id":37736072,"uuid":"90544151","full_name":"alyssaq/3Dreconstruction","owner":"alyssaq","description":"3D reconstruction, sfm with Python3","archived":false,"fork":false,"pushed_at":"2021-12-18T15:27:06.000Z","size":656,"stargazers_count":477,"open_issues_count":9,"forks_count":117,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-29T17:11:08.907Z","etag":null,"topics":["3d-reconstruction","numpy","opencv3","python3","sfm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alyssaq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-07T15:54:48.000Z","updated_at":"2025-03-29T02:55:26.000Z","dependencies_parsed_at":"2022-07-12T15:18:26.930Z","dependency_job_id":null,"html_url":"https://github.com/alyssaq/3Dreconstruction","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyssaq%2F3Dreconstruction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyssaq%2F3Dreconstruction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyssaq%2F3Dreconstruction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyssaq%2F3Dreconstruction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alyssaq","download_url":"https://codeload.github.com/alyssaq/3Dreconstruction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378149,"owners_count":20929297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-reconstruction","numpy","opencv3","python3","sfm"],"created_at":"2024-10-14T21:05:36.026Z","updated_at":"2025-04-05T18:08:58.144Z","avatar_url":"https://github.com/alyssaq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 3D reconstruction\n\n3D reconstruction from 2D images pipeline\n\nSteps:\n1. Detect 2D points\n2. Match 2D points across 2 images\n3. Epipolar geometry   \n  3a. If both intrinsic and extrinsic camera parameters are known, reconstruct with projection matrices.   \n  3b. If only the intrinsic parameters are known, normalize coordinates and calculate the essential matrix.   \n  3c. If neither intrinsic nor extrinsic parameters are known, calculate the fundamental matrix.   \n4. With fundamental or essential matrix, assume P1 = [I 0] and calulate parameters of camera 2.\n5. Triangulate knowing that x1 = P1 * X and x2 = P2 * X.\n6. Bundle adjustment to minimize reprojection errors and refine the 3D coordinates.\n\nNote: Steps and code in this repo is my hobby / learning exercise. Ie, its probably not very efficient. If you wish to use a more production-ready library, check out [OpenCV's SFM module](https://github.com/opencv/opencv_contrib/tree/master/modules/sfm). I have a docker environment for it at: https://github.com/alyssaq/reconstruction\n\n## Prerequisites\n* Python 3.5+\n* Install [OpenCV](http://opencv.org/): [Mac installation steps](https://gist.github.com/alyssaq/f60393545173379e0f3f)\n* pip install -r requirements.txt\n\n## Example 3D cube reconstruction\n```sh\n$ python3 cube_reconstruction.py\n```\n\n## Example Dino 3D reconstruction from 2D images\nDownload images from \u003chttps://www.robots.ox.ac.uk/~vgg/data/mview/\u003e and place into `imgs/dinos`\n```sh\n$ python3 example.py\n```\n\nDetected points and matched across 2 images.\n![](testsets/dino_2d_points.png?raw=true)\n\n3D reconstructed dino with essential matrix   \n![](testsets/dino_3d_reconstructed.png?raw=true)\n\n## 3D to 2D Projection\n```sh\n$ python3 camera.py\n```\n\n3D points of model house from Oxford University VGG datasets.\n![](testsets/house_3d.png?raw=true)\n\nProjected points   \n![](testsets/3d_to_2d_projection.png?raw=true)\n## Datasets\n* Oxford University, Visual Geometry Group: http://www.robots.ox.ac.uk/~vgg/data/data-mview.html\n* EPFL computer vision lab: http://cvlabwww.epfl.ch/data/multiview/knownInternalsMVS.html\n\n## References\n* [Eight point algorithm](http://ece631web.groups.et.byu.net/Lectures/ECEn631%2013%20-%208%20Point%20Algorithm.pdf)\n* [Multiple View Geometry in Computer Vision (Hartley \u0026 Zisserman)](http://www.robots.ox.ac.uk/~vgg/hzbook/)\n\n## License\n[MIT](https://alyssaq.github.io/mit-license)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falyssaq%2F3dreconstruction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falyssaq%2F3dreconstruction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falyssaq%2F3dreconstruction/lists"}