diff --git a/camera.py b/camera.py new file mode 100644 index 0000000..921fa55 --- /dev/null +++ b/camera.py @@ -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