Last active
May 1, 2021 12:04
-
-
Save chilin0525/b60aa0a2c90f783b8bd301b3d5fb6268 to your computer and use it in GitHub Desktop.
Using android phone as webcam by opencv 4.x version.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import cv2 | |
import numpy as np | |
import time | |
import requests | |
URL = "http://192.168.1.101:8080/shot.jpg" | |
while True: | |
img_arr = np.array( | |
bytearray(urllib.request.urlopen(URL).read()), dtype=np.uint8) | |
img = cv2.imdecode(img_arr, -1) | |
cv2.imshow('IPWebcam', img) | |
if cv2.waitKey(0) & 0xFF == ord('q'): | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
solution: