This Python script captures and displays a live stream from an Android camera using OpenCV and requests library.
- Python 3.x
- OpenCV (
pip install opencv-python
) - NumPy (
pip install numpy
) - imutils (
pip install imutils
) - Requests (
pip install requests
)
-
Clone the repository:
git clone https://github.com/shivaniindoria/connect-android-camera-to-opencv-python.git cd android-camera-stream
-
Install the required libraries:
pip install -r requirements.txt
-
Download and install IP Webcam application on your mobile phone.
- Then make sure your PC and Phone both are connected to the same network.
- Open your IP Webcam application on your both, click “Start Server” (usually found under top three lines).
- This will open a camera on your Phone.
- A URL is being displayed on the Phone screen, use the same
url
in your Code.
-
Replace the
url
variable in the script with the correct URL for your Android camera. -
Run the script:
python connect_android_camera_to_opencv_python.py
Press the 'Esc' key to exit the stream.
Feel free to contribute to the project by opening issues or submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.