mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
bugfix, config enhancement and 3 detection modes
Former-commit-id: edfc3e7ccf7b7d727e73a8563acb521045026d5b
This commit is contained in:
@@ -1,11 +1,26 @@
|
||||
|
||||
#include <iostream>
|
||||
// BlackBorders includes
|
||||
#include <blackborder/BlackBorderDetector.h>
|
||||
|
||||
using namespace hyperion;
|
||||
|
||||
BlackBorderDetector::BlackBorderDetector(uint8_t blackborderThreshold) :
|
||||
_blackborderThreshold(blackborderThreshold)
|
||||
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 << "Black border threshold set to " << threshold << " (" << int(blackborderThreshold) << ")" << std::endl;
|
||||
|
||||
return blackborderThreshold;
|
||||
}
|
||||
|
Reference in New Issue
Block a user