{"id":16520065,"url":"https://github.com/pageauc/motion-track","last_synced_at":"2025-03-16T19:30:58.170Z","repository":{"id":35074199,"uuid":"39222641","full_name":"pageauc/motion-track","owner":"pageauc","description":"Windows, Unix, Raspberry Pi Motion Tracking Demo.  Tracks movement in camera view and returns  X, Y Position of Largest Moving Contour in Camera View - See Moved GitHub Project Links","archived":false,"fork":false,"pushed_at":"2018-09-10T00:21:32.000Z","size":887,"stargazers_count":149,"open_issues_count":0,"forks_count":55,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-10-12T16:49:15.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/pageauc?tab=repositories","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"constverum/Quantdom","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pageauc.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-16T22:02:42.000Z","updated_at":"2024-10-03T11:37:12.000Z","dependencies_parsed_at":"2022-09-17T03:11:33.987Z","dependency_job_id":null,"html_url":"https://github.com/pageauc/motion-track","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/pageauc%2Fmotion-track","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageauc%2Fmotion-track/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageauc%2Fmotion-track/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageauc%2Fmotion-track/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pageauc","download_url":"https://codeload.github.com/pageauc/motion-track/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221667188,"owners_count":16860569,"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":[],"created_at":"2024-10-11T16:49:28.545Z","updated_at":"2024-10-27T11:09:02.299Z","avatar_url":"https://github.com/pageauc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MOTION TRACK - Windows, Unix, Raspberry Pi Demo\n### Uses python2/3, Opencv2/3 to do Real Time x,y tracking of largest moving object in camera view.\n### Motion Track Demo [YouTube Video](http://youtu.be/09JS7twPBsQ) \n\n## Introduction\nI did quite a bit of searching on the internet, GitHub, etc, but could not\nat the time find a similar python picamera implementation that returns x,y coordinates of\nthe most dominate moving object in the frame although some came close.\n\n## Prerequisites\nRequires a Raspberry Pi computer with a Web Camera or RPI Camera Module and Recent Raspbian  \nor   \nMS Windows, Unix computer with a Web Camera with recent python installed   \n\nIf you wish to use a web camera that is plugged into a usb port. Set ***WEBCAM = True*** in ***config.py***\notherwise, ***WEBCAM = False*** will use a connected raspberry pi camera module video stream.\nWhen running under Windows or a non RPI unix distro import of pi-camera python \nlibraries will fail and Web camera setting WEBCAM = True will automatically be configured.  \n\nThe Raspberry Pi or Debian dependencies and code files can be installed per the \n***motion-track-install.sh*** curl script below.    \nif you are using MS Win or Non Debian Unix Repo, select the GitHub\n[***Clone or download***](https://github.com/pageauc/motion-track) green button\nat top right of web page and select desired method.\n\n## Quick Install or Upgrade\nEasy Install of motion-track-demo onto Debian or Raspberry Pi Computer with latest Raspbian.\n\n***Step 1*** With mouse left button highlight curl command in code box below. Right click mouse in **highlighted** area and Copy.     \n***Step 2*** On RPI putty SSH or terminal session right click, select paste then Enter to download and run script.     \n\n    curl -L https://raw.github.com/pageauc/motion-track/master/motion-track-install.sh | bash\n\nCommand above will install all code and dependencies   \n***Note*** - a raspbian ***sudo apt-get update*** and upgrade will be performed as part of install\nso it may take some time if these are not up-to-date\n\n## Manual Install\nFrom logged in RPI SSH session or console terminal perform the following.\n\n    wget https://raw.github.com/pageauc/motion-track/master/motion-track-install.sh\n    chmod +x motion-track-install.sh\n    ./motion-track-install.sh\n\n## How to Run\nDefault is console only display. Use Nano or text editor to Edit ***config.py***\nvariable window_on = True\nto display the opencv tracking window on GUI desktop. See other variables\nand descriptions for additional variable customization settings.\nFrom SSH session, console or GUI desktop terminal session execute the following commands\n\n    cd ~/motion-track-demo\n    ./motion-track.py\n\nOn Windows make sure you have the latest python installed from https://www.python.org/downloads/\nRun ***motion-track.py*** from IDLE or if file association exists it can also be\nrun from cmd prompt by double clicking on motion-track.py.  Use a text editor\nto modify config.py to view opencv window(s) and set other configuration\nvariables.\n\n## Trouble Shooting\nif you get an opengl error then see this article about installing opengl on  \na RPI P2  https://www.raspberrypi.org/blog/another-new-raspbian-release/   \n\nOtherwise install opengl support library per following command then reboot.\n\n    sudo apt-get install libgl1-mesa-dri\n\nEdit the config.py file and set variable window_on = True so the opencv status windows can display camera\nmotion images and a circle marking x,y coordinates as well as\nthe threshold images.  The circle diameter can be change using CIRCLE_SIZE\nvariable.\nYou can set window_on = False if you need to run from SSH session.  If\ndebug= True then status information will be displayed without a GUI desktop session.\n\n## Credits\nSome of this code is based on a YouTube tutorial by   \nKyle Hounslow using C here https://www.youtube.com/watch?v=X6rPdRZzgjg   \n\nThanks to Adrian Rosebrock jrosebr1 at http://www.pyimagesearch.com   \nfor the PiVideoStream Class code available on github at   \nhttps://github.com/jrosebr1/imutils/blob/master/imutils/video/pivideostream.py\n\n## motion-track.py\nMotion Track Demo - Basic concept of tracking moving objects.\nThis Demo program detects motion in the field of view and uses opencv to calculate the\nlargest contour above a minimum size and return its x,y coordinate. \n\n## Track Multiple Objects\nThis code example only tracks the largest moving object since it is done in\nreal time. If you are interested in tracking multiple objects you might want to\ntake a look at this github repo for multitracker code example.  \nhttps://github.com/opencv/opencv_contrib/blob/master/modules/tracking/samples/multitracker.py\nMy suggestion would be to cut contours and pass this as the ROI (Rectangle of Interest).\nRead the issues on this since there will be issues regarding objects that leave, enter\nand stop that will need to have new ROI's initialized.\n\n## Project links\n\n* Motion Track Demo YouTube Video http://youtu.be/09JS7twPBsQ   \n* GitHub Repo https://github.com/pageauc/motion-track   \n* RPI forum post https://www.raspberrypi.org/forums/viewtopic.php?p=790082#p790082   \n\n\n## ---------- Other Projects of Mine Based on Motion Tracking ------------\n\n## track-inout.py\nTrack Enter and Leave Activity that cross a vert or horiz center line\nThis project Runs on Windows or Unix using Web Cam or Raspberry Pi using Web Cam or pi camera module\nand Uses Python2/3, OpenCV2/3 to track motion and record object enter or leave camera view when\nthey cross a trigger centerline.\nHas options to take image and/or record data in a csv file   \n* GitHub track inout Repo https://github.com/pageauc/track-inout  \n\n## speed-camera.py\nWindows, Unix vehicle (object) speed camera using motion tracking\nTracks vehicle speeds or other moving objects in real time and records image\nand logs data. Now improved using threading for video stream and clipping of\narea of interest for greater performance.\n* GitHub speed camera Repo https://github.com/pageauc/speed-camera   \n* YouTube Speed Camera Video https://youtu.be/eRi50BbJUro   \n* RPI forum post https://www.raspberrypi.org/forums/viewtopic.php?p=1004150#p1004150   \n\n## cam-track.py\nTracks camera pan/tilt motion position based on opencv template matching\nUses a clipped search image rectangle to search subsequent video stream images and returns\nthe location. Can be used for tracking camera x y movements for stabilization,\nrobotics, Etc.\n* GitHub cam track Repo https://github.com/pageauc/rpi-cam-track   \n* YouTube Cam-Track Video https://www.youtube.com/watch?v=yjA3UtwbD80  \n* Code Walkthrough YouTube Video https://youtu.be/lkh3YbbNdYg    \n* RPI Forum Post https://www.raspberrypi.org/forums/viewtopic.php?p=1027463#p1027463          \n\n## hotspot-game.py\nA simple motion tracking game with motion activated menus\nThe game play involves motion tracking of body motion (hands) to get as many hits\nas possible inside shrinking boxes that randomly move around the screen.\nPosition the camera so you can see body motions either close or standing.\nPretty simple but I think kids would have fun with it and they just might\ntake a look at the code to see how it works, change variables or game logic.\n* GitHub hotspot-game Repo https://github.com/pageauc/hotspot-game   \n* YouTube Hotspot Game Video https://youtu.be/xFl3lmbEO9Y    \n* RPI Forum Post https://www.raspberrypi.org/forums/viewtopic.php?p=1026124#p1026124   \n\n## sonic-track.py\nSend Motion Tracking Data to Sonic Pi to play notes and/or music samples\nThis demo app sends camera motion tracking data to the sonic-pi music program. \nsonic-track sends data to sonic-pi via psonic.py and pythonosc. You will need\na pi camera and a powered speaker connected to the Raspberry Pi audio/video \nplug via appropriate cables or you can attach RPI to an HDMI TV via HDMI cable\nand sound will redirect to TV speakers.\n* GitHub sonic track Repo https://github.com/pageauc/sonic-track\n* YouTube Air Drum Demo https://youtu.be/PSrzbeVX8DE\n* YouTube Air Note Demo https://youtu.be/dC26PUYYR5E\n* YouTube Motion Activated Menus https://youtu.be/PQjpskPAtR0\n\n## ----------------------------------------------------------------------------\n\nHave Fun\nClaude Pageau   \nYouTube Channel https://www.youtube.com/user/pageaucp    \nGitHub Repo https://github.com/pageauc   \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpageauc%2Fmotion-track","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpageauc%2Fmotion-track","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpageauc%2Fmotion-track/lists"}