This commit is contained in:
parent
05b5bc30f2
commit
eebd2f3d96
13
camdetect.py
13
camdetect.py
@ -116,7 +116,6 @@ gauge_queue_frames.labels("hold").set(0)
|
|||||||
gauge_queue_frames.labels("upload").set(0)
|
gauge_queue_frames.labels("upload").set(0)
|
||||||
counter_frames.labels("motion").inc(0)
|
counter_frames.labels("motion").inc(0)
|
||||||
|
|
||||||
|
|
||||||
assert SLIDE_WINDOW <= 8 # This is 256 frames which should be enough
|
assert SLIDE_WINDOW <= 8 # This is 256 frames which should be enough
|
||||||
|
|
||||||
|
|
||||||
@ -273,9 +272,7 @@ async def motion_detector(reference_frame, download_queue, upload_queue):
|
|||||||
"screenshots": [],
|
"screenshots": [],
|
||||||
"action": "event",
|
"action": "event",
|
||||||
}
|
}
|
||||||
},
|
}, upsert=True, return_document=ReturnDocument.AFTER)
|
||||||
upsert = True,
|
|
||||||
return_document=ReturnDocument.AFTER)
|
|
||||||
app.ctx.event_id = event_id = result["_id"]
|
app.ctx.event_id = event_id = result["_id"]
|
||||||
|
|
||||||
# Handle buffering frames prior event start
|
# Handle buffering frames prior event start
|
||||||
@ -375,7 +372,7 @@ async def download(resp, queue):
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
# Assemble JPEG blob
|
# Assemble JPEG blob
|
||||||
blob = buf + data[:marker+2]
|
blob = buf + data[:marker + 2]
|
||||||
|
|
||||||
# Parse DCT coefficients
|
# Parse DCT coefficients
|
||||||
try:
|
try:
|
||||||
@ -394,7 +391,7 @@ async def download(resp, queue):
|
|||||||
except asyncio.QueueFull:
|
except asyncio.QueueFull:
|
||||||
counter_dropped_frames.labels("download").inc()
|
counter_dropped_frames.labels("download").inc()
|
||||||
gauge_queue_frames.labels("download").set(queue.qsize())
|
gauge_queue_frames.labels("download").set(queue.qsize())
|
||||||
data = data[marker+2:]
|
data = data[marker + 2:]
|
||||||
buf = b""
|
buf = b""
|
||||||
counter_receive_frames.inc()
|
counter_receive_frames.inc()
|
||||||
|
|
||||||
@ -467,8 +464,8 @@ async def stream_wrapper(request):
|
|||||||
for y in range(0, app.ctx.mask.shape[0]):
|
for y in range(0, app.ctx.mask.shape[0]):
|
||||||
for x in range(0, app.ctx.mask.shape[1]):
|
for x in range(0, app.ctx.mask.shape[1]):
|
||||||
if app.ctx.mask[y][x] > 0:
|
if app.ctx.mask[y][x] > 0:
|
||||||
img[y*DCT_BLOCK_SIZE:(y+1)*DCT_BLOCK_SIZE,
|
img[y * DCT_BLOCK_SIZE:(y + 1) * DCT_BLOCK_SIZE,
|
||||||
x*DCT_BLOCK_SIZE:(x+1)*DCT_BLOCK_SIZE,
|
x * DCT_BLOCK_SIZE:(x + 1) * DCT_BLOCK_SIZE,
|
||||||
channel] = 255
|
channel] = 255
|
||||||
|
|
||||||
# Compress modified frame as JPEG frame
|
# Compress modified frame as JPEG frame
|
||||||
|
Loading…
Reference in New Issue
Block a user