젯슨 또는 외부 자율주행 차량에서실행
from flask import Flask, Response
import cv2
app = Flask(__name__)
camera = cv2.VideoCapture('/dev/video4')
def generate_frames():
while True:
success, frame = camera.read()
if not success:
break
_, buffer = cv2.imencode('.jpg', frame)
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + buffer.tobytes() + b'\r\n')
@app.route('/')
def index():
return "MJPEG Streaming: <a href='/video_feed'>Click here</a>"
@app.route('/video_feed')
def video_feed():
return Response(generate_frames(),
mimetype='multipart/x-mixed-replace; boundary=frame')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
메인-PC에서 다시 접속 테스트
메인-PC 터미널에서
nc -zv 123.46.*. ****
curl http://123.46.***.** ****/video_feed --output NUL
vlc http://123.46.***.** ****/video_feed --network-caching=100