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:
@@ -282,8 +282,8 @@ Hyperion::Hyperion(const Json::Value &jsonConfig) :
|
||||
// initialize the image processor factory
|
||||
ImageProcessorFactory::getInstance().init(
|
||||
_ledString,
|
||||
jsonConfig["blackborderdetector"].get("enable", true).asBool(),
|
||||
jsonConfig["blackborderdetector"].get("threshold", 0.01).asDouble());
|
||||
jsonConfig["blackborderdetector"]
|
||||
);
|
||||
|
||||
// initialize the color smoothing filter
|
||||
_device = createColorSmoothing(jsonConfig["color"]["smoothing"], _device);
|
||||
|
@@ -8,10 +8,11 @@
|
||||
|
||||
using namespace hyperion;
|
||||
|
||||
ImageProcessor::ImageProcessor(const LedString& ledString, bool enableBlackBorderDetector, uint8_t blackborderThreshold) :
|
||||
//ImageProcessor::ImageProcessor(const LedString& ledString, bool enableBlackBorderDetector, uint8_t blackborderThreshold) :
|
||||
ImageProcessor::ImageProcessor(const LedString& ledString, const Json::Value & blackborderConfig) :
|
||||
_ledString(ledString),
|
||||
_enableBlackBorderRemoval(enableBlackBorderDetector),
|
||||
_borderProcessor(new BlackBorderProcessor(600, 50, 1, blackborderThreshold)),
|
||||
_enableBlackBorderRemoval(blackborderConfig.get("enable", true).asBool()),
|
||||
_borderProcessor(new BlackBorderProcessor(blackborderConfig) ),
|
||||
_imageToLeds(nullptr)
|
||||
{
|
||||
// empty
|
||||
|
@@ -13,25 +13,13 @@ ImageProcessorFactory& ImageProcessorFactory::getInstance()
|
||||
return instance;
|
||||
}
|
||||
|
||||
void ImageProcessorFactory::init(const LedString& ledString, bool enableBlackBorderDetector, double blackborderThreshold)
|
||||
void ImageProcessorFactory::init(const LedString& ledString, const Json::Value & blackborderConfig)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
_blackborderConfig = blackborderConfig;
|
||||
}
|
||||
|
||||
ImageProcessor* ImageProcessorFactory::newImageProcessor() const
|
||||
{
|
||||
return new ImageProcessor(_ledString, _enableBlackBorderDetector, _blackborderThreshold);
|
||||
return new ImageProcessor(_ledString, _blackborderConfig);
|
||||
}
|
||||
|
Reference in New Issue
Block a user