mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-22 19:59:02 +03:00
Compare commits
40
Commits
v0.5.0
..
v0.5.0-rc7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e6eca7cd6 | ||
|
|
91415f7e9d | ||
|
|
0f66a8cb41 | ||
|
|
04ef6ac30e | ||
|
|
ab42a9625d | ||
|
|
30ad0e30f8 | ||
|
|
7bad89c9bf | ||
|
|
f077c397f4 | ||
|
|
cc729d83a8 | ||
|
|
c520b81e49 | ||
|
|
9c304391c0 | ||
|
|
9a12b02d22 | ||
|
|
7686c510b3 | ||
|
|
2f5e322d3c | ||
|
|
1cd4c12104 | ||
|
|
1a8b034685 | ||
|
|
da6dc03a57 | ||
|
|
7fa3b70d2d | ||
|
|
1fc5a2bfd4 | ||
|
|
7e84da7dad | ||
|
|
128be72e28 | ||
|
|
aaddedc95c | ||
|
|
ba919fb439 | ||
|
|
b1d563f3c4 | ||
|
|
204d8af5df | ||
|
|
b507a73d79 | ||
|
|
66eeb8b5cb | ||
|
|
efa67067c6 | ||
|
|
aeb036f1a4 | ||
|
|
74c528f9dc | ||
|
|
f2d54bec43 | ||
|
|
f07d57741e | ||
|
|
2c1ec19f98 | ||
|
|
6a9027c002 | ||
|
|
60c15e4419 | ||
|
|
03dbf600aa | ||
|
|
fbbb79b31b | ||
|
|
496c6bc6c4 | ||
|
|
869a81c944 | ||
|
|
5b1884cfb3 |
+6
-11
@@ -9,7 +9,7 @@ import multiprocessing as mp
|
||||
import subprocess as sp
|
||||
import numpy as np
|
||||
import logging
|
||||
from flask import Flask, Response, make_response, jsonify, request
|
||||
from flask import Flask, Response, make_response, jsonify
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
from frigate.video import track_camera
|
||||
@@ -218,26 +218,21 @@ def main():
|
||||
|
||||
@app.route('/<camera_name>')
|
||||
def mjpeg_feed(camera_name):
|
||||
fps = int(request.args.get('fps', '3'))
|
||||
height = int(request.args.get('h', '360'))
|
||||
if camera_name in CONFIG['cameras']:
|
||||
# return a multipart response
|
||||
return Response(imagestream(camera_name, fps, height),
|
||||
return Response(imagestream(camera_name),
|
||||
mimetype='multipart/x-mixed-replace; boundary=frame')
|
||||
else:
|
||||
return "Camera named {} not found".format(camera_name), 404
|
||||
|
||||
def imagestream(camera_name, fps, height):
|
||||
def imagestream(camera_name):
|
||||
while True:
|
||||
# max out at specified FPS
|
||||
time.sleep(1/fps)
|
||||
# max out at 1 FPS
|
||||
time.sleep(1)
|
||||
frame = object_processor.get_current_frame(camera_name)
|
||||
if frame is None:
|
||||
frame = np.zeros((height,int(height*16/9),3), np.uint8)
|
||||
|
||||
frame = cv2.resize(frame, dsize=(int(height*16/9), height), interpolation=cv2.INTER_LINEAR)
|
||||
frame = np.zeros((720,1280,3), np.uint8)
|
||||
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
|
||||
|
||||
ret, jpg = cv2.imencode('.jpg', frame)
|
||||
yield (b'--frame\r\n'
|
||||
b'Content-Type: image/jpeg\r\n\r\n' + jpg.tobytes() + b'\r\n\r\n')
|
||||
|
||||
Reference in New Issue
Block a user