Posted on



This video demonstrates how to easily fetch a live video stream from your Android phone to your PC and then process it using OpenCV and Python.

Explore my tutorials:

More awesome topics covered here:
WhatsApp Bot using Twilio and Python:
Discovering Hidden APIs:
RegEx in Python:
Introduction to Numpy:
Introduction to Matplotlib:
Introduction to Pandas:
Intermediate Python:
Functional Programming in Python:
Python Package Publishing:
Multithreading in Python:
Multiprocessing in Python:
Parallel Programming in Python:
Concurrent Programming in Python:
Dataclasses in Python:
Exploring YouTube Data API:
Jupyter Notebook (Tips, Tricks and Hacks):
Decorators in Python:
Inside Python:
Exploring datetime:
Computer Vision for noobs:
Python for web:
Awesome Linux Terminal:
Tips, tricks, hacks and APIs:
Optical Character Recognition:
Facebook Messenger Bot Tutorial:

Facebook:
Github:
Twitter:

#python #opencv #android

Nguồn: https://hdwallpaperslovely.com

Xem thêm bài viết khác: https://hdwallpaperslovely.com/cong-nghe/

32 Replies to “Process Android phone live stream using OpenCV and Python”

  1. import kivy.app import App

    from kivy.uix.label import Label

    class myApp(App)

    def build(self):

    return Label(text"hello world ")

    if __name__=='__main__'

    myApp().run()

  2. import kivy.app import App

    from kivy.uix.label import Label

    class myApp(App)

    def build(self):

    return Label(text"hello world ")

    if __name__=='__main__'

    myApp().run()

  3. Hi,
    Thank you for this tutorial. I did get the code to run on spyder but video streaming is not happening. Just the image is showing when I run the file. Can you help me with this?

  4. Oh amn you are a life saver. I would have wasted hours trying to do what you explained in 6 minutes man. I what other contexts can i do that /shot.jpg?? Is this something you can do in every webpage or this is different?? Any way, thanks lot man

  5. but you say what about to go with video. I am not able anything with this. please send me how i am read this stuf

  6. Code in video:

    import cv2

    import numpy as np

    import requests

    url="http://192.168.1.3:8080/shot.jpg"

    while (1):

    img_resp=requests.get(url)

    img_arr=np.array(bytearray(img_resp.content), dtype=np.uint8)

    img=cv2.imdecode(img_arr,-1)

    cv2.imshow("android cam",img)

    if cv2.waitKey(1)==27:

    break

  7. Solid Effort, but you don't need all of this. just add the ip address in normal video capture syntax instead of 0. cap = cv2.VideoCapture("http://192.168.0.88:8080/video")

  8. import cv2
    # Load the cascade
    face_cascade = cv2.CascadeClassifier('cascade.xml')
    # To capture video from webcam.
    cap = cv2.VideoCapture(0)
    # To use a video file as input
    # cap = cv2.VideoCapture('filename.mp4')
    while True:
    # Read the frame
    _, img = cap.read()
    # Convert to grayscale
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    # Detect the faces
    faces = face_cascade.detectMultiScale(gray, 1.5, 4)
    # Draw the rectangle around each face
    for (x, y, w, h) in faces:
    cv2.rectangle(img, (x, y), (x+w, y+h), (0,180, 0), 2)
    # Display
    font = cv2.FONT_HERSHEY_SIMPLEX
    cv2.putText(img,'bottle',(x,y),font,1,(0,0,0),2)
    cv2.imshow('img', img)
    # Stop if escape key is pressed
    if cv2.waitKey(1) & 0xff == ord('q'):
    break
    # Release the VideoCapture object
    cap.release()
    cap.destroyAllWindows()

    This is my Python opencv code I am using videocapture() where this url paste in this how to open webcam for this

  9. Hey, i'm using pycharm on windows, and it gives me an error that says ModuleNotFoundError: No module named 'requests'

    could you help me?

  10. Hi Indian Pythonista,

    I love your tutorials, but I've got a little tricky question: It's about an Android phone, a USB-C camera and a calculator.

    The camera hangs on the smartphone and is detected at the address / dev / bus / usb / 001/003 ~ the question now:

    How can i make a video with this config on the o.g. Stream computers as much as possible in real time? On the machine is a Debian-based distro & the data consumption via LTE does not matter.

    If you or someone else has an idea I would be very grateful.

  11. Great tutorial…Can you give me suggestion related to this. I want to playback that live stream from server to android app. Can you tell me how to get stream into android app. (exact same thing in android application instead of python as you did)

  12. You can also create a VideoCapture like this:
    phoneCam = cv2.VideoCapture("http://<Phone address>:8080/video")

  13. Dude, do you know how to make an Android app(java based) but the process is python but in the web? Something like what you've done

  14. thank you for your great work Mr. The thing is i need to access my inbuild webcam from my machine to other machine. can you please clarify it. and one more how can i access from different servers

Leave a Reply

Your email address will not be published. Required fields are marked *