Add support to set the threshold for each RGB channel separately

Former-commit-id: 5edb206bb2657e78f711f67625fd5f6164d8296c
This commit is contained in:
johan
2014-03-04 22:04:15 +01:00
parent 4888294e03
commit 5e3cb497fa
9 changed files with 92 additions and 48 deletions

View File

@@ -24,8 +24,7 @@ class V4L2Grabber : public QObject
Q_OBJECT
public:
V4L2Grabber(
const std::string & device,
V4L2Grabber(const std::string & device,
int input,
VideoStandard videoStandard,
int width,
@@ -43,6 +42,11 @@ public slots:
void set3D(VideoMode mode);
void setSignalThreshold(double redSignalThreshold,
double greenSignalThreshold,
double blueSignalThreshold,
int noSignalCounterThreshold);
void start();
void stop();
@@ -110,10 +114,14 @@ private:
int _frameDecimation;
int _horizontalPixelDecimation;
int _verticalPixelDecimation;
int _noSignalCounterThreshold;
ColorRgb _noSignalThresholdColor;
VideoMode _mode3D;
int _currentFrame;
int _noSignalCounter;
QSocketNotifier * _streamNotifier;
};

View File

@@ -19,6 +19,9 @@ public:
int height,
int frameDecimation,
int pixelDecimation,
double redSignalThreshold,
double greenSignalThreshold,
double blueSignalThreshold,
Hyperion * hyperion,
int hyperionPriority);
virtual ~V4L2Wrapper();

View File

@@ -48,3 +48,10 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
return os;
}
/// Compare operator to check if a color is 'smaller' than another color
inline bool operator<(const ColorRgb & lhs, const ColorRgb & rhs)
{
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue);
}