This commit is contained in:
redpanther
2016-07-15 10:28:12 +02:00
parent b49ada956b
commit d3e77eb018
5 changed files with 42 additions and 13 deletions

View File

@@ -9,7 +9,8 @@
using namespace hyperion;
BlackBorderProcessor::BlackBorderProcessor(const Json::Value &blackborderConfig)
: _unknownSwitchCnt(blackborderConfig.get("unknownFrameCnt", 600).asUInt())
: _enabled(blackborderConfig.get("enable", true).asBool())
, _unknownSwitchCnt(blackborderConfig.get("unknownFrameCnt", 600).asUInt())
, _borderSwitchCnt(blackborderConfig.get("borderFrameCnt", 50).asUInt())
, _maxInconsistentCnt(blackborderConfig.get("maxInconsistentCnt", 10).asUInt())
, _blurRemoveCnt(blackborderConfig.get("blurRemoveCnt", 1).asUInt())
@@ -20,7 +21,10 @@ BlackBorderProcessor::BlackBorderProcessor(const Json::Value &blackborderConfig)
, _consistentCnt(0)
, _inconsistentCnt(10)
{
Debug(Logger::getInstance("BLACKBORDER"), "mode: %s", _detectionMode.c_str());
if (_enabled)
{
Debug(Logger::getInstance("BLACKBORDER"), "mode: %s", _detectionMode.c_str());
}
}
BlackBorder BlackBorderProcessor::getCurrentBorder() const
@@ -28,6 +32,16 @@ BlackBorder BlackBorderProcessor::getCurrentBorder() const
return _currentBorder;
}
bool BlackBorderProcessor::enabled() const
{
return _enabled;
}
void BlackBorderProcessor::setEnabled(bool enable)
{
_enabled = enable;
}
bool BlackBorderProcessor::updateBorder(const BlackBorder & newDetectedBorder)
{
// the new changes ignore false small borders (no reset of consistance)
@@ -92,4 +106,4 @@ bool BlackBorderProcessor::updateBorder(const BlackBorder & newDetectedBorder)
}
return borderChanged;
}
}

View File

@@ -66,7 +66,7 @@ Effect::Effect(PyThreadState * mainThreadState, int priority, int timeout, const
_colors.resize(_imageProcessor->getLedCount(), ColorRgb::BLACK);
// disable the black border detector for effects
_imageProcessor->enableBalckBorderDetector(false);
_imageProcessor->enableBlackBorderDetector(false);
// connect the finished signal
connect(this, SIGNAL(finished()), this, SLOT(effectFinished()));

View File

@@ -11,7 +11,6 @@ using namespace hyperion;
//ImageProcessor::ImageProcessor(const LedString& ledString, bool enableBlackBorderDetector, uint8_t blackborderThreshold) :
ImageProcessor::ImageProcessor(const LedString& ledString, const Json::Value & blackborderConfig) :
_ledString(ledString),
_enableBlackBorderRemoval(blackborderConfig.get("enable", true).asBool()),
_borderProcessor(new BlackBorderProcessor(blackborderConfig) ),
_imageToLeds(nullptr)
{
@@ -44,9 +43,9 @@ void ImageProcessor::setSize(const unsigned width, const unsigned height)
_imageToLeds = new ImageToLedsMap(width, height, 0, 0, _ledString.leds());
}
void ImageProcessor::enableBalckBorderDetector(bool enable)
void ImageProcessor::enableBlackBorderDetector(bool enable)
{
_enableBlackBorderRemoval = enable;
_borderProcessor->setEnabled(enable);
}
bool ImageProcessor::getScanParameters(size_t led, double &hscanBegin, double &hscanEnd, double &vscanBegin, double &vscanEnd) const