Signal detection fails due to BGR-RGB assumption

Forum for questions and support relating to the 1.26.x releases only.
Locked
jcrews
Posts: 3
Joined: Fri Jan 31, 2014 11:22 pm

Signal detection fails due to BGR-RGB assumption

Post 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;
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: Signal detection fails due to BGR-RGB assumption

Post by mastertheknife »

Thank you for this. This will be included in zm v1.27.1.
Kfir Itzhak.
Locked