{"id":17127831,"url":"https://github.com/antiboredom/camera-motion-detector","last_synced_at":"2025-04-13T05:34:37.424Z","repository":{"id":70711883,"uuid":"556982985","full_name":"antiboredom/camera-motion-detector","owner":"antiboredom","description":"Uses opencv to detect when a camera is panning or zooming.","archived":false,"fork":false,"pushed_at":"2023-11-05T04:49:44.000Z","size":4684,"stargazers_count":80,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-16T08:55:02.326Z","etag":null,"topics":["camera","opencv","video"],"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/antiboredom.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,"governance":null}},"created_at":"2022-10-24T22:01:36.000Z","updated_at":"2024-04-10T19:01:58.000Z","dependencies_parsed_at":"2023-05-26T22:45:45.172Z","dependency_job_id":null,"html_url":"https://github.com/antiboredom/camera-motion-detector","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/antiboredom%2Fcamera-motion-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antiboredom%2Fcamera-motion-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antiboredom%2Fcamera-motion-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antiboredom%2Fcamera-motion-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antiboredom","download_url":"https://codeload.github.com/antiboredom/camera-motion-detector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219846897,"owners_count":16556420,"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":["camera","opencv","video"],"created_at":"2024-10-14T19:05:30.484Z","updated_at":"2024-10-14T19:05:31.127Z","avatar_url":"https://github.com/antiboredom.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Camera Motion Detection\n\nThis project uses optical flow to determine camera motion (pans and zooms).\n\nNOTE: I'm not great at CV stuff so please excuse the probably not-ideal way of doing things here. And big thanks to Golan Levin and Alexander Porter for helping me figure it out...\n\n## Usage\n\n`detect.py` will analyze a video frame by frame and record a `csv` file containing average camera motion angle, magnitude and \"zoom factor.\" Zoomy-ness is determined by what percentage of pixels appear to be moving *away* from the center of the image.\n\nTo run:\n\n```\npython detect.py somevideo.mp4\n```\n\nIf you have CUDA you can run the GPU optimized version with:\n\n```\npython detect.py somevideo.mp4 --gpu\n```\n\nYou can also preview the analysis with:\n\n```\npython detect.py somevideo.mp4 --preview\n```\n\n### Rendering out different camera motions\n\nYou can make use of the generated `csv` file in a few different ways. I've also included a `render.py` script that attempts to extract zooming and panning shots (your mileage may vary with it!).\n\nTo save out all the zoom shots:\n\n```\npython render.py somevideo.mp4 --zooms --output zooms.mp4\n```\n\nIf you have mpv installed you can also preview this without rendering a new file:\n\n\n```\npython render.py somevideo.mp4 --zooms --preview\n```\n\nFor panning shots, specify the desired panning angle like so:\n\n```\npython render.py somevideo.mp4 --pans --angle 180\n```\n\n\n## Installation\n\n\n### CPU\n\nInstall the requirements with:\n\n```\npip install -r requirements.txt\n```\n\nYou're done!\n\n\n### GPU\n\nIf you've got an nvidia card you can use the GPU version which is significantly faster. You need opencv with cuda which you can either compile yourself or use a [docker image](https://github.com/Fizmath/Docker-opencv-GPU).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantiboredom%2Fcamera-motion-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantiboredom%2Fcamera-motion-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantiboredom%2Fcamera-motion-detector/lists"}