Skip to content

Instantly share code, notes, and snippets.

@nikhilkumarsingh
Created October 30, 2017 08:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilkumarsingh/0db840f27f1f0fd0747f13ab80d0ca37 to your computer and use it in GitHub Desktop.
Save nikhilkumarsingh/0db840f27f1f0fd0747f13ab80d0ca37 to your computer and use it in GitHub Desktop.
Processing a live video stream from android phone to PC using Python.
import requests
import cv2
import numpy as np
url = "http://192.168.43.1:8080/shot.jpg"
while True:
img_resp = requests.get(url)
img_arr = np.array(bytearray(img_resp.content), dtype=np.uint8)
img = cv2.imdecode(img_arr, -1)
cv2.imshow("AndroidCam", img)
if cv2.waitKey(1) == 27:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment