2016-02-07 13:26:40 +01:00
|
|
|
#include <iostream>
|
2016-07-10 23:14:23 +02:00
|
|
|
#include <utils/Logger.h>
|
|
|
|
|
2014-01-26 14:23:08 +01:00
|
|
|
// BlackBorders includes
|
|
|
|
#include <blackborder/BlackBorderDetector.h>
|
2016-02-10 19:22:19 +01:00
|
|
|
#include <cmath>
|
2013-08-21 16:25:27 +02:00
|
|
|
|
2013-08-23 07:08:44 +02:00
|
|
|
using namespace hyperion;
|
|
|
|
|
2016-07-10 23:14:23 +02:00
|
|
|
BlackBorderDetector::BlackBorderDetector(double threshold)
|
|
|
|
: _blackborderThreshold(calculateThreshold(threshold))
|
2013-08-21 16:25:27 +02:00
|
|
|
{
|
2013-08-21 16:52:03 +02:00
|
|
|
// empty
|
2013-08-21 16:25:27 +02:00
|
|
|
}
|
2016-02-07 13:26:40 +01:00
|
|
|
|
2020-08-08 00:21:19 +02:00
|
|
|
uint8_t BlackBorderDetector::calculateThreshold(double threshold) const
|
2016-02-07 13:26:40 +01:00
|
|
|
{
|
|
|
|
int rgbThreshold = int(std::ceil(threshold * 255));
|
|
|
|
if (rgbThreshold < 0)
|
|
|
|
rgbThreshold = 0;
|
|
|
|
else if (rgbThreshold > 255)
|
|
|
|
rgbThreshold = 255;
|
|
|
|
|
|
|
|
uint8_t blackborderThreshold = uint8_t(rgbThreshold);
|
|
|
|
|
|
|
|
return blackborderThreshold;
|
|
|
|
}
|