2013-08-13 11:10:45 +02:00
|
|
|
|
|
|
|
// Hyperion includes
|
|
|
|
#include <hyperion/ImageProcessorFactory.h>
|
|
|
|
#include <hyperion/ImageProcessor.h>
|
|
|
|
|
|
|
|
ImageProcessorFactory& ImageProcessorFactory::getInstance()
|
|
|
|
{
|
|
|
|
static ImageProcessorFactory instance;
|
|
|
|
// Return the singleton instance
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2014-01-20 20:46:38 +01:00
|
|
|
void ImageProcessorFactory::init(const LedString& ledString, bool enableBlackBorderDetector, double blackborderThreshold)
|
2013-08-13 11:10:45 +02:00
|
|
|
{
|
|
|
|
_ledString = ledString;
|
2013-10-20 22:27:05 +02:00
|
|
|
_enableBlackBorderDetector = enableBlackBorderDetector;
|
2014-01-20 20:46:38 +01:00
|
|
|
|
|
|
|
int threshold = int(std::ceil(blackborderThreshold * 255));
|
|
|
|
if (threshold < 0)
|
|
|
|
threshold = 0;
|
|
|
|
else if (threshold > 255)
|
|
|
|
threshold = 255;
|
|
|
|
_blackborderThreshold = uint8_t(threshold);
|
|
|
|
|
|
|
|
if (_enableBlackBorderDetector)
|
|
|
|
{
|
|
|
|
std::cout << "Black border threshold set to " << blackborderThreshold << " (" << int(_blackborderThreshold) << ")" << std::endl;
|
|
|
|
}
|
2013-08-13 11:10:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ImageProcessor* ImageProcessorFactory::newImageProcessor() const
|
|
|
|
{
|
2014-01-20 20:46:38 +01:00
|
|
|
return new ImageProcessor(_ledString, _enableBlackBorderDetector, _blackborderThreshold);
|
2013-08-13 11:10:45 +02:00
|
|
|
}
|