From c3ba03e0eebaa11b6018634414c15f7124054900 Mon Sep 17 00:00:00 2001 From: johan Date: Sat, 22 Mar 2014 14:49:24 +0100 Subject: [PATCH] Fix v4l2 signal threshold comparison Former-commit-id: 698a22af752fc42e778e97587938ed6542653bd9 --- deploy/hyperion.tar.gz.REMOVED.git-id | 2 +- include/utils/ColorRgb.h | 6 ++++++ libsrc/grabber/v4l2/V4L2Grabber.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/deploy/hyperion.tar.gz.REMOVED.git-id b/deploy/hyperion.tar.gz.REMOVED.git-id index 7870ca65..3c26a2f2 100644 --- a/deploy/hyperion.tar.gz.REMOVED.git-id +++ b/deploy/hyperion.tar.gz.REMOVED.git-id @@ -1 +1 @@ -0172259694aa374d6ae32dcbd122a62ce5bd3b05 \ No newline at end of file +90bef144811aa3c3db8620622b57e76f699f0121 \ No newline at end of file diff --git a/include/utils/ColorRgb.h b/include/utils/ColorRgb.h index ea544fe0..bbf9f615 100644 --- a/include/utils/ColorRgb.h +++ b/include/utils/ColorRgb.h @@ -55,3 +55,9 @@ inline bool operator<(const ColorRgb & lhs, const ColorRgb & rhs) { return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue); } + +/// Compare operator to check if a color is 'smaller' than or 'equal' to another color +inline bool operator<=(const ColorRgb & lhs, const ColorRgb & rhs) +{ + return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue); +} diff --git a/libsrc/grabber/v4l2/V4L2Grabber.cpp b/libsrc/grabber/v4l2/V4L2Grabber.cpp index 2e4bf67d..526f5754 100644 --- a/libsrc/grabber/v4l2/V4L2Grabber.cpp +++ b/libsrc/grabber/v4l2/V4L2Grabber.cpp @@ -695,7 +695,7 @@ void V4L2Grabber::process_image(const uint8_t * data) ColorRgb & rgb = image(xDest, yDest); yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue); - noSignal &= rgb < _noSignalThresholdColor; + noSignal &= rgb <= _noSignalThresholdColor; } }