A demonstration of the OpenCV library, updated to work with Requests. Most other repos I found with this info used the older urllib and made heavy use of deprecated functions that broke the code when used in Python 3.0 and above.
Basically, this is an update to Python 3.x and part 1 of a tutorial on live image recognition using OpenCV and tensorflow in Python. (You will not need tensorflow for this portion of the tutorial.)
- Python 3.x
- OpenCV
- Requests, the only Non-GMO HTTP library for Python, safe for human consumption.
- IPWebcam Android app
-
(Optional) I strongly recommend using a virtual environment like Anaconda for development. While it is not necessary, it prevents interference with any other Python installations, and will be required for the latter portions of this tutorial. Once installed, the environment can be created and opened like so:
$ conda create -n androidCV pip python=3.5 Solving enviornment: done $ source activate androidCV
-
Make sure you have Python 3.0 or higher installed on your computer
$ python -V Python 3.5.5 :: Anaconda, Inc.
-
Install OpenCV version 3.x
$ conda install -c conda-forge opencv -
Install Requests
$ conda install -c anaconda requests -
Install IPWebcam on your phone
-
Clone this repository
$ git clone https://github.com/njohnsoncpe/android-opencv.git /path/to/dir/ -
Make sure that the phone and the computer are on the same Wifi network
Start the webcam server on your phone and take note of the ip address at the bottom of the screen, you will need that to run the program.
The syntax of the program call is as follows:
$ python ipcam.py -ip [ipaddr] -usr [username] -pass [password]