Page 1 of 1

Signal detection fails due to BGR-RGB assumption

Posted: Sat Feb 01, 2014 12:25 am
by jcrews
After upgrading to ZM 1.26.x (currently at .5-git), I've noticed the cameras have changed from blue to red during a signal loss. The specified color is 75% blue, and signal losses are being reported as motion, so I took a look at zm_monitor.cpp.

It turned out that when a remote camera fails, a frame is Fill()ed with the signal_loss_colour. However, this is incorrect, since the signal_loss_colour may be in BGR if it's a HTML hex.

By doing an rgb_convert from BGR, the signal loss detection and fill colour both function correctly.

A plain long is also allowed in the database field; since the HTML hex has a specified subpixel order, and a long does not, removing acceptance of long from the contract may be a good idea.

Code: Select all

--- a/src/zm_monitor.cpp
+++ b/src/zm_monitor.cpp
@@ -2693,7 +2693,7 @@ int Monitor::Capture()
     {
         // Unable to capture image for temporary reason
         // Fake a signal loss image
-        capture_image->Fill( signal_check_colour );
+        capture_image->Fill(rgb_convert(signal_check_colour, ZM_SUBPIX_ORDER_BGR));
         captureResult = 0;
     } else { 
         captureResult = 1;

Re: Signal detection fails due to BGR-RGB assumption

Posted: Wed Apr 23, 2014 10:38 am
by mastertheknife
Thank you for this. This will be included in zm v1.27.1.