hyperion.ng/libsrc/hyperion/ImageProcessorFactory.cpp
T. van der Zwan 4b9dfe3e03 Added missing include
Former-commit-id: b35b00821740d48ba073344ac734a5a24c23637e
2014-02-25 20:49:43 +01:00

38 lines
1.0 KiB
C++

// STL includes
#include <cmath>
// Hyperion includes
#include <hyperion/ImageProcessorFactory.h>
#include <hyperion/ImageProcessor.h>
ImageProcessorFactory& ImageProcessorFactory::getInstance()
{
static ImageProcessorFactory instance;
// Return the singleton instance
return instance;
}
void ImageProcessorFactory::init(const LedString& ledString, bool enableBlackBorderDetector, double blackborderThreshold)
{
_ledString = ledString;
_enableBlackBorderDetector = enableBlackBorderDetector;
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;
}
}
ImageProcessor* ImageProcessorFactory::newImageProcessor() const
{
return new ImageProcessor(_ledString, _enableBlackBorderDetector, _blackborderThreshold);
}