Kill "Rainbow lights" when v4l grabber has no signal (#334)

* on v4l screenshot, print out nosignal threshold values

* separate fractional parameters for no signal detection

* fully implement handling for "rainbow grabber"
This commit is contained in:
redPanther
2016-12-16 19:48:43 +01:00
committed by GitHub
parent b227f5a71c
commit d59c94421d
12 changed files with 251 additions and 36 deletions

View File

@@ -8,6 +8,7 @@
// Qt includes
#include <QObject>
#include <QSocketNotifier>
#include <QRectF>
// util includes
#include <utils/Image.h>
@@ -35,9 +36,12 @@ public:
int height,
int frameDecimation,
int horizontalPixelDecimation,
int verticalPixelDecimation);
int verticalPixelDecimation
);
virtual ~V4L2Grabber();
QRectF getSignalDetectionOffset();
public slots:
void setCropping(int cropLeft,
int cropRight,
@@ -46,11 +50,18 @@ public slots:
void set3D(VideoMode mode);
void setSignalThreshold(double redSignalThreshold,
void setSignalThreshold(
double redSignalThreshold,
double greenSignalThreshold,
double blueSignalThreshold,
int noSignalCounterThreshold);
void setSignalDetectionOffset(
double verticalMin,
double horizontalMin,
double verticalMax,
double horizontalMax);
bool start();
void stop();
@@ -137,4 +148,11 @@ private:
Logger * _log;
bool _initialized;
bool _deviceAutoDiscoverEnabled;
bool _noSignalDetected;
double _x_frac_min;
double _y_frac_min;
double _x_frac_max;
double _y_frac_max;
};

View File

@@ -29,11 +29,10 @@ public:
public slots:
bool start();
void stop();
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
void set3D(VideoMode mode);
// signals:

View File

@@ -61,3 +61,16 @@ 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 'greater' 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);
}
/// Compare operator to check if a color is 'greater' 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);
}