mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Added parameters to constructor of blackborder processor
Added blur line removal Moved blackborder classes to hyperion namespace
This commit is contained in:
parent
c43b99359a
commit
046c68574e
@ -2,6 +2,8 @@
|
|||||||
// Local-Hyperion includes
|
// Local-Hyperion includes
|
||||||
#include "BlackBorderDetector.h"
|
#include "BlackBorderDetector.h"
|
||||||
|
|
||||||
|
using namespace hyperion;
|
||||||
|
|
||||||
BlackBorderDetector::BlackBorderDetector()
|
BlackBorderDetector::BlackBorderDetector()
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
// Utils includes
|
// Utils includes
|
||||||
#include <utils/RgbImage.h>
|
#include <utils/RgbImage.h>
|
||||||
|
|
||||||
|
namespace hyperion
|
||||||
|
{
|
||||||
///
|
///
|
||||||
/// Result structure of the detected blackborder.
|
/// Result structure of the detected blackborder.
|
||||||
///
|
///
|
||||||
@ -65,3 +67,4 @@ private:
|
|||||||
// TODO[TvdZ]: We could add a threshold to check that the color is close to black
|
// TODO[TvdZ]: We could add a threshold to check that the color is close to black
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} // end namespace hyperion
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
|
|
||||||
|
// Local-Hyperion includes
|
||||||
#include "BlackBorderProcessor.h"
|
#include "BlackBorderProcessor.h"
|
||||||
|
|
||||||
BlackBorderProcessor::BlackBorderProcessor() :
|
using namespace hyperion;
|
||||||
_unknownSwitchCnt(600),
|
|
||||||
_borderSwitchCnt(50),
|
BlackBorderProcessor::BlackBorderProcessor(
|
||||||
|
const unsigned unknownFrameCnt,
|
||||||
|
const unsigned borderFrameCnt,
|
||||||
|
const unsigned blurRemoveCnt) :
|
||||||
|
_unknownSwitchCnt(unknownFrameCnt),
|
||||||
|
_borderSwitchCnt(borderFrameCnt),
|
||||||
|
_blurRemoveCnt(blurRemoveCnt),
|
||||||
_detector(),
|
_detector(),
|
||||||
_currentBorder({BlackBorder::unknown, 0}),
|
_currentBorder({BlackBorder::unknown, 0}),
|
||||||
_lastDetectedBorder({BlackBorder::unknown, 0}),
|
_lastDetectedBorder({BlackBorder::unknown, 0}),
|
||||||
@ -12,6 +20,11 @@ BlackBorderProcessor::BlackBorderProcessor() :
|
|||||||
|
|
||||||
BlackBorder BlackBorderProcessor::getCurrentBorder() const
|
BlackBorder BlackBorderProcessor::getCurrentBorder() const
|
||||||
{
|
{
|
||||||
|
if (_currentBorder.size > 0)
|
||||||
|
{
|
||||||
|
return {_currentBorder.type, _currentBorder.size+int(_blurRemoveCnt)};
|
||||||
|
}
|
||||||
|
|
||||||
return _currentBorder;
|
return _currentBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,15 @@
|
|||||||
// Local Hyperion includes
|
// Local Hyperion includes
|
||||||
#include "BlackBorderDetector.h"
|
#include "BlackBorderDetector.h"
|
||||||
|
|
||||||
|
namespace hyperion
|
||||||
|
{
|
||||||
class BlackBorderProcessor
|
class BlackBorderProcessor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlackBorderProcessor();
|
BlackBorderProcessor(
|
||||||
|
const unsigned unknownFrameCnt,
|
||||||
|
const unsigned borderFrameCnt,
|
||||||
|
const unsigned blurRemoveCnt);
|
||||||
|
|
||||||
BlackBorder getCurrentBorder() const;
|
BlackBorder getCurrentBorder() const;
|
||||||
|
|
||||||
@ -19,6 +24,8 @@ private:
|
|||||||
|
|
||||||
const unsigned _borderSwitchCnt;
|
const unsigned _borderSwitchCnt;
|
||||||
|
|
||||||
|
unsigned _blurRemoveCnt;
|
||||||
|
|
||||||
BlackBorderDetector _detector;
|
BlackBorderDetector _detector;
|
||||||
|
|
||||||
BlackBorder _currentBorder;
|
BlackBorder _currentBorder;
|
||||||
@ -27,4 +34,4 @@ private:
|
|||||||
|
|
||||||
unsigned _consistentCnt;
|
unsigned _consistentCnt;
|
||||||
};
|
};
|
||||||
|
} // end namespace hyperion
|
||||||
|
@ -9,35 +9,35 @@ SET(Hyperion_QT_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
SET(Hyperion_HEADERS
|
SET(Hyperion_HEADERS
|
||||||
${CURRENT_HEADER_DIR}/LedString.h
|
|
||||||
${CURRENT_HEADER_DIR}/LedDevice.h
|
|
||||||
${CURRENT_HEADER_DIR}/ImageProcessor.h
|
${CURRENT_HEADER_DIR}/ImageProcessor.h
|
||||||
${CURRENT_HEADER_DIR}/ImageProcessorFactory.h
|
${CURRENT_HEADER_DIR}/ImageProcessorFactory.h
|
||||||
|
${CURRENT_HEADER_DIR}/LedDevice.h
|
||||||
|
${CURRENT_HEADER_DIR}/LedString.h
|
||||||
${CURRENT_HEADER_DIR}/PriorityMuxer.h
|
${CURRENT_HEADER_DIR}/PriorityMuxer.h
|
||||||
|
|
||||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.h
|
|
||||||
${CURRENT_SOURCE_DIR}/LedDeviceTest.h
|
|
||||||
${CURRENT_SOURCE_DIR}/ImageToLedsMap.h
|
|
||||||
${CURRENT_SOURCE_DIR}/BlackBorderProcessor.h
|
|
||||||
${CURRENT_SOURCE_DIR}/BlackBorderDetector.h
|
${CURRENT_SOURCE_DIR}/BlackBorderDetector.h
|
||||||
|
${CURRENT_SOURCE_DIR}/BlackBorderProcessor.h
|
||||||
${CURRENT_SOURCE_DIR}/ColorTransform.h
|
${CURRENT_SOURCE_DIR}/ColorTransform.h
|
||||||
${CURRENT_SOURCE_DIR}/HsvTransform.h
|
${CURRENT_SOURCE_DIR}/HsvTransform.h
|
||||||
|
${CURRENT_SOURCE_DIR}/ImageToLedsMap.h
|
||||||
|
${CURRENT_SOURCE_DIR}/LedDeviceTest.h
|
||||||
|
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(Hyperion_SOURCES
|
SET(Hyperion_SOURCES
|
||||||
${CURRENT_SOURCE_DIR}/LedString.cpp
|
|
||||||
${CURRENT_SOURCE_DIR}/Hyperion.cpp
|
${CURRENT_SOURCE_DIR}/Hyperion.cpp
|
||||||
${CURRENT_SOURCE_DIR}/ImageProcessor.cpp
|
${CURRENT_SOURCE_DIR}/ImageProcessor.cpp
|
||||||
${CURRENT_SOURCE_DIR}/ImageProcessorFactory.cpp
|
${CURRENT_SOURCE_DIR}/ImageProcessorFactory.cpp
|
||||||
|
${CURRENT_SOURCE_DIR}/LedString.cpp
|
||||||
${CURRENT_SOURCE_DIR}/PriorityMuxer.cpp
|
${CURRENT_SOURCE_DIR}/PriorityMuxer.cpp
|
||||||
|
|
||||||
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.cpp
|
|
||||||
${CURRENT_SOURCE_DIR}/LedDeviceTest.cpp
|
|
||||||
${CURRENT_SOURCE_DIR}/ImageToLedsMap.cpp
|
|
||||||
${CURRENT_SOURCE_DIR}/BlackBorderProcessor.cpp
|
|
||||||
${CURRENT_SOURCE_DIR}/BlackBorderDetector.cpp
|
${CURRENT_SOURCE_DIR}/BlackBorderDetector.cpp
|
||||||
|
${CURRENT_SOURCE_DIR}/BlackBorderProcessor.cpp
|
||||||
${CURRENT_SOURCE_DIR}/ColorTransform.cpp
|
${CURRENT_SOURCE_DIR}/ColorTransform.cpp
|
||||||
${CURRENT_SOURCE_DIR}/HsvTransform.cpp
|
${CURRENT_SOURCE_DIR}/HsvTransform.cpp
|
||||||
|
${CURRENT_SOURCE_DIR}/ImageToLedsMap.cpp
|
||||||
|
${CURRENT_SOURCE_DIR}/LedDeviceWs2801.cpp
|
||||||
|
${CURRENT_SOURCE_DIR}/LedDeviceTest.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(Hyperion_RESOURCES
|
set(Hyperion_RESOURCES
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// Hyperion includes
|
// Hyperion includes
|
||||||
#include "hyperion/BlackBorderDetector.h"
|
#include "hyperion/BlackBorderDetector.h"
|
||||||
|
|
||||||
|
using namespace hyperion;
|
||||||
|
|
||||||
RgbColor randomColor()
|
RgbColor randomColor()
|
||||||
{
|
{
|
||||||
const uint8_t randomRedValue = uint8_t(rand() % (std::numeric_limits<uint8_t>::max() + 1));
|
const uint8_t randomRedValue = uint8_t(rand() % (std::numeric_limits<uint8_t>::max() + 1));
|
||||||
|
@ -5,8 +5,11 @@
|
|||||||
// Utils includes
|
// Utils includes
|
||||||
#include <utils/RgbImage.h>
|
#include <utils/RgbImage.h>
|
||||||
|
|
||||||
|
// Local-Hyperion includes
|
||||||
#include "hyperion/BlackBorderProcessor.h"
|
#include "hyperion/BlackBorderProcessor.h"
|
||||||
|
|
||||||
|
using namespace hyperion;
|
||||||
|
|
||||||
RgbColor randomColor()
|
RgbColor randomColor()
|
||||||
{
|
{
|
||||||
const uint8_t randomRedValue = uint8_t(rand() % (std::numeric_limits<uint8_t>::max() + 1));
|
const uint8_t randomRedValue = uint8_t(rand() % (std::numeric_limits<uint8_t>::max() + 1));
|
||||||
@ -40,8 +43,9 @@ int main()
|
|||||||
{
|
{
|
||||||
unsigned unknownCnt = 600;
|
unsigned unknownCnt = 600;
|
||||||
unsigned borderCnt = 50;
|
unsigned borderCnt = 50;
|
||||||
|
unsigned blurCnt = 0;
|
||||||
|
|
||||||
BlackBorderProcessor processor;
|
BlackBorderProcessor processor(unknownCnt, borderCnt, blurCnt);
|
||||||
|
|
||||||
// Start with 'no border' detection
|
// Start with 'no border' detection
|
||||||
RgbImage noBorderImage = createImage(64, 64, 0, 0);
|
RgbImage noBorderImage = createImage(64, 64, 0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user