Raspberry Pi のカメラから UDP 経由で画像をストリーミングしようとしています。Androidデバイスで受信/表示しています。
私の計算によると、私のアプリケーションは最大 10 fps で送信しますが、25 fps が必要です。
私のソリューションをスピードアップする方法、またはより良いソリューションを知っている人はいますか?
私のコードは次のとおりです
sock=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((UDP_IP, UDP_PORT))
camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 30
rawCapture = PiRGBArray(camera, size=(640, 480))
time.sleep(0.1)
for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
image = frame.array
img = Image.fromarray(image,'RGB')
output = StringIO.StringIO()
img.save(output, format='JPEG')
contents = output.getvalue()
output.close()
sock.send(contents)
key = cv2.waitKey(1) & 0xFF
rawCapture.truncate(0)
sock.close