mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	* cleanup: remove ambiled device as written at the forum this is no longer supported. All people should move to adalight. They just need to flash a new sketch. * fix typo * travis.ci * travis: move to ubuntu 14.04 * script try * add serialport * update .json files * . * . * . * update travis * fix * typo * fix * . * disable v4l2 on mac * disable email notification * update osx * maybe fix * . * disable osx and rm v4l2 * try osx * try fix * travis update * add oe systemd file * Proto * Json * fix * fix2 * fix3 * . * typo * update * revert runtime error
		
			
				
	
	
		
			30 lines
		
	
	
		
			709 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			709 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include <iostream>
 | 
						|
#include <utils/Logger.h>
 | 
						|
 | 
						|
// 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);
 | 
						|
 | 
						|
	Debug(Logger::getInstance("BLACKBORDER"), "threshold set to %f (%d)", threshold , int(blackborderThreshold));
 | 
						|
 | 
						|
	return blackborderThreshold;
 | 
						|
}
 |