Connect your android phone camera to OpenCV - Python Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Prerequisites: OpenCV OpenCV is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and videos to identify objects, faces, or even the handwriting of a human. Many a time, while doing Computer Vision or Image Processing using our PC's webcam is not a very option. Maybe we want to increase the camera quality of our webcam, or we want to create some image processing applications which will use an android camera as the medium. This article uses Windows to do this. But the basics of the code will be same on other Operating systems too. ApproachDownload 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 at the bottom). This will open a camera on your Phone.A URL is being displayed on the Phone screen, type the same URL on your PC browser, and under "Video renderer" Section, click on "Javascript".You can see video captured on your phone, which starts showing up on your browser. Now, what we will be going to do is, taking image data from the URL using the request module and convert this to an image frame using NumPy, and finally, start using our Android camera as a webcam in Python.In the code:Import moduleAdd URL displayed in your phoneContinuous fetch data from URLKeep displaying this data collectedClose window Program: Python3 # Import essential libraries import requests import cv2 import numpy as np import imutils # Replace the below URL with your own. Make sure to add "/shot.jpg" at last. url = "http://192.168.0.103:8080/shot.jpg" # While loop to continuously fetching data from the Url while True: img_resp = requests.get(url) img_arr = np.array(bytearray(img_resp.content), dtype=np.uint8) img = cv2.imdecode(img_arr, -1) img = imutils.resize(img, width=1000, height=1800) cv2.imshow("Android_cam", img) # Press Esc key to exit if cv2.waitKey(1) == 27: break cv2.destroyAllWindows() Output: Comment More infoAdvertise with us H harshsinha3682 Follow Improve Article Tags : Technical Scripter Python Technical Scripter 2020 Python-OpenCV Practice Tags : python Explore Python FundamentalsPython Introduction 3 min read Input and Output in Python 4 min read Python Variables 6 min read Python Operators 5 min read Python Keywords 2 min read Python Data Types 8 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 7 min read Python Functions 8 min read Recursion in Python 6 min read Python Lambda Functions 6 min read Python Data StructuresPython String 6 min read Python Lists 6 min read Python Tuples 6 min read Dictionaries in Python 7 min read Python Sets 10 min read Python Arrays 9 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 6 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 2 min read Python MySQL 9 min read Python Packages 12 min read Python Modules 7 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 11 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 6 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 15+ min read StatsModel Library- Tutorial 4 min read Learning Model Building in Scikit-learn 8 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 7 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 10 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 7 min read Python | Build a REST API using Flask 3 min read How to Create a basic API using Django Rest Framework ? 4 min read Python PracticePython Quiz 3 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like