This project is a proof of concept where we in conjunction with a raspberry pi with an attached pi camera use camera recognition with Python 2.7 and OpenCV 3.2 to detect cars moving in and out of a parking lot.
Links to other repositories which tie in with this project:
Version: 0.5.1
Clone down the project in the manner that you prefer, example from terminal:
$ git clone https://github.com/Archheretic/ParkingLotTracker .git
If your interested in contributing to the project look at Contributing
While it is a prerequisite to own a raspberry pi with an official pi camera to be able to run the CarTrackerStream natively, it is not a prerequisite to if you want to test it or develop yourself inside of a docker container. However, you will need to use a video-clip or find another way to stream video to the application.
To try this project for yourself, you have two options:
If you have a raspberry pi with an attached camera module a debian-based OS (alpine, raspbian jessie to name a few): Compile OpenCV3.2 for python 2.7 yourself following the instructions found here
Use pip to get packages for with NumPy, Request and PiCamera
pip install NumPy Request PiCamera
Run CarTrackerStream.py with python 2.7 from where you cloned the project with the following command: python CarTrackerStream.py
If you do not have a raspberry pi with an attached camera module but would like to test/develop in docker:
Due to time constraints, we do not have our own docker image available. In the mean time you can use this image.
Install Docker on your machine.
Pull docker image with the following command:
docker pull rickryan/rpi-jessie-opencv3.2
Run the following command to run the program:
python CarTrackerStream.py
This project should be able to run natively on a Raspberry Pi with a Pi Camera module. The way it is currently designed, it will only work if the camera is placed such that cars that travel upwards are moving in to a parking lot and cars that are moving down are leaving the parking lot. These values are easily changed, if these need to be reversed, but more heavy modifications would need to be made if the tracking would be horizontal or diagonal as opposed to vertical.
Before we run the docker image, we must first connect xhost with docker to ensure that we can see the images produced.
xhost +local:docker
Run the docker image with the following command:
docker run -ti -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-v `pwd`:`pwd` -w `pwd` \
rickryan/rpi-jessie-opencv3.2:latest
With the docker image running, navigate to where you cloned your project and enter the following command:
python CarTrackerVideo.py
This should run the program and display the video output generated by OpenCV to your screen.
When you are done using the docker container it is a good idea to close xhost:
xhost -local:docker
This project welcomes contributions from the community. Contributions are accepted using GitHub pull requests. If you're not familiar with making GitHub pull requests, please refer to the GitHub documentation "Creating a pull request".
For a good pull request, we ask you provide the following:
- Try to include a clear description of your pull request in the description. It should include the basic "what" and "why"s for the request.
- The pull request should include tests for the change. A new feature should have tests for the new feature and bug fixes should include a test that fails without the corresponding code change and passes after they are applied.
- If the pull request is a new feature, please be sure to include all
appropriate documentation additions in the
Readme.md
file as well.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details
Thanks to https://github.com/mysqljs/mysql for README inspiration, and a big thanks to the whole open source community that has created the development framework and our dependencies in general.b