Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions camera.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import urllib.request
import cv2
import numpy as np
import time

# Replace the URL with your own IPwebcam shot.jpg IP:port
url='http://10.12.3.179:8008'

while True:

# Use urllib to get the image and convert into a cv2 usable format
imgResp=urllib.request.urlopen(url)
imgNp=np.array(bytearray(imgResp.read()),dtype=np.uint8)
img=cv2.imdecode(imgNp,-1)

# put the image on screen
cv2.imshow('IPWebcam',img)


#To give the processor some less stress
#time.sleep(0.1)

if cv2.waitKey(1) & 0xFF == ord('q'):
break