hyperion.ng/libsrc/blackborder/BlackBorderDetector.cpp
brindosch fa66c3b2b5 Rework log messages
Former-commit-id: eac93c0fd78fdf353e940d08df3cabf0b962a3e2
2016-03-23 17:40:45 +01:00

28 lines
694 B
C++

#include <iostream>
// BlackBorders includes
#include <blackborder/BlackBorderDetector.h>
#include <cmath>
using namespace hyperion;
BlackBorderDetector::BlackBorderDetector(double threshold) :
_blackborderThreshold(calculateThreshold(threshold))
{
// empty
}
uint8_t BlackBorderDetector::calculateThreshold(double threshold)
{
int rgbThreshold = int(std::ceil(threshold * 255));
if (rgbThreshold < 0)
rgbThreshold = 0;
else if (rgbThreshold > 255)
rgbThreshold = 255;
uint8_t blackborderThreshold = uint8_t(rgbThreshold);
std::cout << "BLACKBORDER INFO: threshold set to " << threshold << " (" << int(blackborderThreshold) << ")" << std::endl;
return blackborderThreshold;
}