![]() ![]() But if you’ve followed any of the OpenCV install tutorials on this blog, then this step is not optional since your OpenCV bindings are stored in a virtual environment. I’ve marked this step as optional only because in some cases, you may not be using a Python virtual environment. (Optional) Accesses our Python virtual environment. ![]() Creating the launcherīefore we can execute our Python script on reboot, we first need to create a shell script that performs two important tasks: Today, we are going to take this example alarm program and modify it so that it can be started automatically when the Raspberry Pi boots up - we will not have to manually execute any command to start our alarm program. ![]() Our program is able to detect the presence of the ball, light up an LED on the board, and if there was sound, you could hear the buzzer going off as well. Here we can see the green ball is in view of the camera. If this green ball is detected, an alarm is raised by activating a buzzer and lighting up an LED on the TrafficHAT module (which is connected to a Raspberry Pi): Figure 2: The TrafficHAT module for the Raspberry Pi, which includes 3 LED lights, a buzzer, and push button, all of which are programmable via GPIO.Īn example of the “activated alarm” can be seen below: Figure 3: Notice how when the green ball is detected in the video stream, the LED on the TrafficHAT lights up. In last week’s post, I demonstrated how to create an “alarm” program that detects this green ball in a video stream: Figure 1: The green ball we will be detecting in our video stream. I’ll be using my Raspberry Pi to accomplish, but the same general instructions apply for other Linux distributions and OSX as well - all you need to do is change the paths to your scripts. Looking for the source code to this post? Jump Right To The Downloads Section Running a Python + OpenCV script on rebootĪs I mentioned in the introduction to this blog post, we’ll be using crontab to launch a script on system reboot. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |