{"id":14977938,"url":"https://github.com/arbazkhan4712/smart-security-camera-pi3","last_synced_at":"2025-10-28T07:30:35.923Z","repository":{"id":101646152,"uuid":"196988841","full_name":"Arbazkhan4712/Smart-Security-Camera-Pi3","owner":"Arbazkhan4712","description":"IoT Raspberry Pi security camera running open-cv for object detection. The camera will send an email with an image of any objects it detects. It also runs a server that provides a live video stream over the internet.","archived":false,"fork":false,"pushed_at":"2020-05-07T18:01:05.000Z","size":359,"stargazers_count":16,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T12:44:09.952Z","etag":null,"topics":["detection","opencv","python","raspberry-pi-camera","security-camera","stream-video","tutorial"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Arbazkhan4712.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-15T11:51:27.000Z","updated_at":"2024-06-13T09:16:42.000Z","dependencies_parsed_at":"2023-06-07T06:00:15.693Z","dependency_job_id":null,"html_url":"https://github.com/Arbazkhan4712/Smart-Security-Camera-Pi3","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"37004991afbbfe4516970fad946a05f9aec56efe"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arbazkhan4712%2FSmart-Security-Camera-Pi3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arbazkhan4712%2FSmart-Security-Camera-Pi3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arbazkhan4712%2FSmart-Security-Camera-Pi3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arbazkhan4712%2FSmart-Security-Camera-Pi3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arbazkhan4712","download_url":"https://codeload.github.com/Arbazkhan4712/Smart-Security-Camera-Pi3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238608338,"owners_count":19500362,"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":["detection","opencv","python","raspberry-pi-camera","security-camera","stream-video","tutorial"],"created_at":"2024-09-24T13:56:34.574Z","updated_at":"2025-10-28T07:30:35.494Z","avatar_url":"https://github.com/Arbazkhan4712.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart-Security-Camera-Pi3\n\n[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://www.python.org/)                  [![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)          [![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/)\n\n [![GitHub forks](https://img.shields.io/github/forks/arbazkhan4712/Smart-Security-Camera-Pi3?style=social)](https://GitHub.com/Naereen/StrapDown.js/network/)                 [![GitHub star](https://img.shields.io/github/stars/arbazkhan4712/Smart-Security-Camera-Pi3?style=social)](https://GitHub.com/Naereen/StrapDown.js/network/)\n\n\n\nIoT Raspberry Pi security camera running open-cv for object detection. The camera will send an email with an image of any objects it detects. It also runs a server that provides a live video stream over the internet.\n\nVIDEO:\n\n[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/hN_ycikjrWg/0.jpg)](https://www.youtube.com/watch?v=hN_ycikjrWg)\n\n## Setup\n\nThis project uses a Raspberry Pi Camera to stream video. Before running the code, make sure to configure the raspberry pi camera on your device.\n\nOpen the terminal and run\n\n```\nsudo raspi-config\n```\n\nSelect `Interface Options`, then `Pi Camera` and toggle on. Press `Finish` and exit.\n\nYou can verify that the camera works by running\n\n```\nraspistill -o image.jpg\n```\nwhich will save a image from the camera in your current directory. You can open up the file inspector and view the image.\n\n## Installing Dependencies\n\nThis project uses openCV to detect objects in the video feed. You can install openCV by using the following [tutorial](http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/). I used the Python 2.7 version of the tutorial.\n\nThe installation took almost 8 hours (!!) on my Raspberry Pi Zero, but it would be considerably faster on a more powerful board like the Raspberry Pi 3.\n\nThe tutorial will prompt you to create a virtual environment. Make sure you are using the virtual environment by typing the following commands.\n\n```bash\nsource ~/.profile\nworkon cv\n```\n\nNext, navigate to the repository directory\n\n```\ncd Smart-Security-Camera\n```\n\nand install the dependencies for the project\n\n```\npip install -r requirements.txt\n```\n\n*Note: If you're running python3, you'll have to change the import statements at the top of the mail.py file*\n\n```\nfrom email.mime.multipart import MIMEMultipart\nfrom email.mime.text import MIMEText\nfrom email.mime.image import MIMEImage\n```\n*and change your print statements from quotes to parenthesis*\n\n```\nprint \"\" =\u003e print()\n```\n\n## Customization\n\nTo get emails when objects are detected, you'll need to make a couple modifications to the `mail.py` file.\n\nOpen `mail.py` with vim `vim mail.py`, then press `i` to edit. Scroll down to the following section\n\n```\n# Email you want to send the update from (only works with gmail)\nfromEmail = 'myemail@gmail.com'\nfromEmailPassword = 'password1234'\n\n# Email you want to send the update to\ntoEmail = 'anotheremail@gmail.com'\n```\nand replace with your own email/credentials. The `mail.py` file logs into a gmail SMTP server and sends an email with an image of the object detected by the security camera. \n\nPress `esc` then `ZZ` to save and exit.\n\nYou can also modify the `main.py` file to change some other properties.\n\n```\nemail_update_interval = 600 # sends an email only once in this time interval\nvideo_camera = VideoCamera(flip=True) # creates a camera object, flip vertically\nobject_classifier = cv2.CascadeClassifier(\"models/fullbody_recognition_model.xml\") # an opencv classifier\n```\nNotably, you can use a different object detector by changing the path `\"models/fullbody_recognition_model.xml\"` in `object_classifier = cv2.CascadeClassifier(\"models/fullbody_recognition_model.xml\")`.\n\nto a new model in the models directory.\n\n```\nfacial_recognition_model.xml\nfullbody_recognition_model.xml\nupperbody_recognition_model.xml\n```\n\n## Running the Program\n\nRun the program\n\n```\npython main.py\n```\n\nYou can view a live stream by visiting the ip address of your pi in a browser on the same network. You can find the ip address of your Raspberry Pi by typing `ifconfig` in the terminal and looking for the `inet` address. \n\nVisit `\u003craspberrypi_ip\u003e:5000` in your browser to view the stream.\n\nNote: To view the live stream on a different network than your Raspberry Pi, you can use [ngrok](https://ngrok.com/) to expose a local tunnel. Once downloaded, run ngrok with `./ngrok http 5000` and visit one of the generated links in your browser.\n\n\n## License \u0026 Copyright\n© [Arbaz Khan](https://arbazkhan4712.github.io/Contact.html)\n\nLicensed under the [MIT License](License)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farbazkhan4712%2Fsmart-security-camera-pi3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farbazkhan4712%2Fsmart-security-camera-pi3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farbazkhan4712%2Fsmart-security-camera-pi3/lists"}