Open your terminal and type:
sudo python -m pip install rpistream
Open cmd as admin and type:
pip install rpistream
Server
from rpistream.camera import Camera
from rpistream.streamserver import Server
import cv2
def retrieveImage(cam,imgResize):
image = cv2.resize(cam.image,(0,0),fx=imgResize,fy=imgResize)
return image
cam = Camera(mirror=True)
scale=0.5
server = Server(port=5000)
server.serve() # Blocking; waits for a connection before continuing
server.startStream(retrieveImage,[cam,scale]) # Calls retrieveImage(*args) every frame
Client
from rpistream.streamclient import Client
import cv2
client = Client(serverIp="localhost", port = 5000) # Connects to the server
client.startStream() # Starts recieving data and displaying the video
- numpy
- zstandard
- openCv-python