bugfix, config enhancement and 3 detection modes

Former-commit-id: edfc3e7ccf7b7d727e73a8563acb521045026d5b
This commit is contained in:
wisc
2016-02-07 13:26:40 +01:00
parent 6b052081f7
commit 2b703de669
11 changed files with 213 additions and 60 deletions

View File

@@ -1,6 +1,8 @@
#pragma once
// Jsoncpp includes
#include <json/json.h>
// Local Hyperion includes
#include "BlackBorderDetector.h"
@@ -23,11 +25,7 @@ namespace hyperion
/// outer pixels is blurred (black and color combined due to image scaling))
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
///
BlackBorderProcessor(
const unsigned unknownFrameCnt,
const unsigned borderFrameCnt,
const unsigned blurRemoveCnt,
uint8_t blackborderThreshold);
BlackBorderProcessor(const Json::Value &blackborderConfig);
///
/// Return the current (detected) border
@@ -48,7 +46,14 @@ namespace hyperion
bool process(const Image<Pixel_T> & image)
{
// get the border for the single image
BlackBorder imageBorder = _detector.process(image);
BlackBorder imageBorder;
if (_detectionMode == "default") {
imageBorder = _detector.process(image);
} else if (_detectionMode == "classic") {
imageBorder = _detector.process_classic(image);
} else if (_detectionMode == "osd") {
imageBorder = _detector.process_osd(image);
}
// add blur to the border
if (imageBorder.horizontalSize > 0)
{
@@ -80,9 +85,15 @@ namespace hyperion
/// The number of horizontal/vertical borders detected before it becomes the current border
const unsigned _borderSwitchCnt;
// The number of frames that are "ignored" before a new border gets set as _previousDetectedBorder
const unsigned _maxInconsistentCnt;
/// The number of pixels to increase a detected border for removing blury pixels
unsigned _blurRemoveCnt;
/// The border detection mode
const std::string _detectionMode;
/// The blackborder detector
BlackBorderDetector _detector;
@@ -96,5 +107,6 @@ namespace hyperion
unsigned _consistentCnt;
/// The number of frame the previous detected border NOT matched the incomming border
unsigned _inconsistentCnt;
};
} // end namespace hyperion