From b05bc211f744870e82193a5737985866b19dbb18 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 3 Feb 2022 10:50:40 -0500 Subject: [PATCH] Apparently it is actually the Y channel that we want. --- src/zm_monitor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 2b6436379..a33b00c40 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2003,7 +2003,7 @@ bool Monitor::Analyse() { ) ) { Debug(1, "assigning refimage from v-channel"); Image v_image(snap->in_frame->width, - snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Assign(v_image); } else if (snap->image) { Debug(1, "assigning refimage from snap->image"); @@ -2093,7 +2093,7 @@ bool Monitor::Analyse() { ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUVJ420P) ) ) { Debug(1, "assigning refimage from v-channel"); - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Assign(v_image); } else { Debug(1, "assigning refimage from snap->image"); @@ -2108,7 +2108,7 @@ bool Monitor::Analyse() { || ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUVJ420P) ) ) { - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); snap->score = DetectMotion(v_image, zoneSet); } else { snap->score = DetectMotion(*(snap->image), zoneSet); @@ -2337,7 +2337,7 @@ bool Monitor::Analyse() { ((AVPixelFormat)snap->in_frame->format == AV_PIX_FMT_YUVJ420P) ) ) { Debug(1, "Assigning from vchannel"); - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Assign(v_image); } else if (snap->image) { Debug(1, "Assigning"); @@ -2352,7 +2352,7 @@ bool Monitor::Analyse() { ) ) { Debug(1, "Blending from vchannel"); - Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[2], 0); + Image v_image(snap->in_frame->width, snap->in_frame->height, 1, ZM_SUBPIX_ORDER_NONE, snap->in_frame->data[0], 0); ref_image.Blend(v_image, ( state==ALARM ? alarm_ref_blend_perc : ref_blend_perc )); } else if (snap->image) { Debug(1, "Blending because %p and format %d != %d, %d", snap->in_frame,