{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/megasam-accurate-fast-and-robust-structure","title":"MegaSaM: Accurate, Fast, and Robust Structure and Motion from Casual Dynamic Videos","arxiv_id":"2412.04463","date":"2024-12-05","proceeding":null,"authors":["Zhengqi Li","Richard Tucker","Forrester Cole","Qianqian Wang","Linyi Jin","Vickie Ye","Angjoo Kanazawa","Aleksander Holynski","Noah Snavely"],"abstract":"We present a system that allows for accurate, fast, and robust estimation of camera parameters and depth maps from casual monocular videos of dynamic scenes. Most conventional structure from motion and monocular SLAM techniques assume input videos that feature predominantly static scenes with large amounts of parallax. Such methods tend to produce erroneous estimates in the absence of these conditions. Recent neural network-based approaches attempt to overcome these challenges; however, such methods are either computationally expensive or brittle when run on dynamic videos with uncontrolled camera motion or unknown field of view. We demonstrate the surprising effectiveness of a deep visual SLAM framework: with careful modifications to its training and inference schemes, this system can scale to real-world videos of complex dynamic scenes with unconstrained camera paths, including videos with little camera parallax. Extensive experiments on both synthetic and real videos demonstrate that our system is significantly more accurate and robust at camera pose and depth estimation when compared with prior and concurrent work, with faster or comparable running times. See interactive results on our project page: https://mega-sam.github.io/","url_abs":"https://arxiv.org/abs/2412.04463v2","url_pdf":"https://arxiv.org/pdf/2412.04463v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"megasam-accurate-fast-and-robust-structure","repo_url":"https://github.com/mega-sam/mega-sam","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"depth-estimation","task_name":"Depth Estimation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2412.04463","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2412.04463"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mega-sam/mega-sam","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":14},"by_repo_kind":{"listed":{"samples":14,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"bda1ea37848c1a5f","entry":"get_camera_rays","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/geometry_utils.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/geometry_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bda1ea37848c1a5f"}},{"code_sha256_prefix":"de454ae3ade5d9ae","entry":"gradient_loss","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/cvd_opt.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/cvd_opt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"de454ae3ade5d9ae"}},{"code_sha256_prefix":"1e7d6a056f2488fa","entry":"pose_distance","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/geometry_utils.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/geometry_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1e7d6a056f2488fa"}},{"code_sha256_prefix":"1f7b4cd3dea533ca","entry":"read_cameras_binary","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"colmap_read_model.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/colmap_read_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1f7b4cd3dea533ca"}},{"code_sha256_prefix":"c9dc32524dba1c3e","entry":"read_cameras_binary","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"camera_tracking_scripts/colmap_read_model.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/camera_tracking_scripts/colmap_read_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c9dc32524dba1c3e"}},{"code_sha256_prefix":"b768293892633d35","entry":"read_cameras_text","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"colmap_read_model.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/colmap_read_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b768293892633d35"}},{"code_sha256_prefix":"35498794a9af2019","entry":"read_cameras_text","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"camera_tracking_scripts/colmap_read_model.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/camera_tracking_scripts/colmap_read_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"35498794a9af2019"}},{"code_sha256_prefix":"735c9f07e56255b5","entry":"read_next_bytes","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"colmap_read_model.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/colmap_read_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"735c9f07e56255b5"}},{"code_sha256_prefix":"f651b415cb3682d6","entry":"read_next_bytes","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"camera_tracking_scripts/colmap_read_model.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/camera_tracking_scripts/colmap_read_model.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f651b415cb3682d6"}},{"code_sha256_prefix":"72464163e1ed4a8b","entry":"resize_flow","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/preprocess_flow.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/preprocess_flow.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"72464163e1ed4a8b"}},{"code_sha256_prefix":"ac04d341cfd51f93","entry":"si_loss","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/cvd_opt.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/cvd_opt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ac04d341cfd51f93"}},{"code_sha256_prefix":"7e492e661d45f956","entry":"sobel_fg_alpha","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/cvd_opt.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/cvd_opt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7e492e661d45f956"}},{"code_sha256_prefix":"71da5d76a02a0fe3","entry":"to_homogeneous","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/geometry_utils.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/geometry_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"71da5d76a02a0fe3"}},{"code_sha256_prefix":"b0ed5fdc9c9400a1","entry":"warp_flow","repo":"mega-sam/mega-sam","repo_kind":"listed","path":"cvd_opt/preprocess_flow.py","file_url":"https://github.com/mega-sam/mega-sam/blob/HEAD/cvd_opt/preprocess_flow.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b0ed5fdc9c9400a1"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}