mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Implement letterbox-only blackbar detection mode (#1063)
This commit is contained in:
parent
958975975c
commit
85a55de28c
@ -15,7 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- New LED Device SK9822 (#1005)
|
||||
- Support SK9822 type LEDs with adaptive brightness control via SPI (#1017)
|
||||
- Provide additional details on Hardware/CPU information (#1045)
|
||||
- Allow execution with option "--version", while another hyperion daemon is running
|
||||
Allow execution with option "--version", while another hyperion daemon is running
|
||||
- New blackbar detection mode "Letterbox", that considers only bars at the top and bottom of picture
|
||||
- Systray icons added - Issue #925 (#1040)
|
||||
- DirectX9 Grabber (#1039)
|
||||
- Added DirectX SDK to CompileHowto
|
||||
|
@ -261,6 +261,7 @@
|
||||
"edt_conf_enum_automatic": "Automatic",
|
||||
"edt_conf_enum_bbclassic": "Classic",
|
||||
"edt_conf_enum_bbdefault": "Default",
|
||||
"edt_conf_enum_bbletterbox": "Letterbox",
|
||||
"edt_conf_enum_bbosd": "OSD",
|
||||
"edt_conf_enum_bgr": "BGR",
|
||||
"edt_conf_enum_bottom_up": "Bottom up",
|
||||
|
@ -178,7 +178,7 @@
|
||||
/// * borderFrameCnt : Number of frames before a consistent detected border gets set (default 50)
|
||||
/// * maxInconsistentCnt : Number of inconsistent frames that are ignored before a new border gets a chance to proof consistency
|
||||
/// * blurRemoveCnt : Number of pixels that get removed from the detected border to cut away blur (default 1)
|
||||
/// * mode : Border detection mode (values=default,classic,osd)
|
||||
/// * mode : Border detection mode (values=default,classic,osd,letterbox)
|
||||
"blackborderdetector" :
|
||||
{
|
||||
"enable" : true,
|
||||
|
@ -93,6 +93,7 @@ Explain the differences between the available modes for blackbar detection.
|
||||
* **Default:** 3 scanlines in each direction (X Y) - fastest detection
|
||||
* **Classic:** The original implementation - lower cpu time (legacy for RPi 1) just scan the top one third of the picture which leads to a slow detection and trouble with TV channel logo.
|
||||
* **OSD:** Based on the default mode - not that effective but prevents border switching which may caused of OSD overlays (program infos and volume bar).
|
||||
* **Letterbox:** Based on the default mode - only considers blackbars at the top and bottom of the picture, ignoring the sides.
|
||||
<ImageWrap src="/images/en/user_bbmodes.jpg" alt="Hyperion Blackbar detection modes" />
|
||||
|
||||
## Gamma Curve
|
||||
|
@ -234,6 +234,49 @@ namespace hyperion
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// letterbox detection mode (5lines top-bottom only detection)
|
||||
template <typename Pixel_T>
|
||||
BlackBorder process_letterbox(const Image<Pixel_T> & image) const
|
||||
{
|
||||
// test center and 25%, 75% of width
|
||||
// 25 and 75 will check both top and bottom
|
||||
// center will only check top (minimise false detection of captions)
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
int width25percent = width / 4;
|
||||
int height33percent = height / 3;
|
||||
int width75percent = width25percent * 3;
|
||||
int xCenter = width / 2;
|
||||
|
||||
|
||||
int firstNonBlackYPixelIndex = -1;
|
||||
|
||||
height--; // remove 1 pixel to get end pixel index
|
||||
|
||||
// find first Y pixel of the image
|
||||
for (int y = 0; y < height33percent; ++y)
|
||||
{
|
||||
if (!isBlack(image(xCenter, y))
|
||||
|| !isBlack(image(width25percent, y))
|
||||
|| !isBlack(image(width75percent, y))
|
||||
|| !isBlack(image(width25percent, (height - y)))
|
||||
|| !isBlack(image(width75percent, (height - y))))
|
||||
{
|
||||
firstNonBlackYPixelIndex = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Construct result
|
||||
BlackBorder detectedBorder;
|
||||
detectedBorder.unknown = firstNonBlackYPixelIndex == -1;
|
||||
detectedBorder.horizontalSize = firstNonBlackYPixelIndex;
|
||||
detectedBorder.verticalSize = 0;
|
||||
return detectedBorder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -79,6 +79,8 @@ namespace hyperion
|
||||
imageBorder = _detector->process_classic(image);
|
||||
} else if (_detectionMode == "osd") {
|
||||
imageBorder = _detector->process_osd(image);
|
||||
} else if (_detectionMode == "letterbox") {
|
||||
imageBorder = _detector->process_letterbox(image);
|
||||
}
|
||||
// add blur to the border
|
||||
if (imageBorder.horizontalSize > 0)
|
||||
|
@ -60,10 +60,10 @@
|
||||
{
|
||||
"type" : "string",
|
||||
"title": "edt_conf_bb_mode_title",
|
||||
"enum" : ["default", "classic", "osd"],
|
||||
"enum" : ["default", "classic", "osd", "letterbox"],
|
||||
"default" : "default",
|
||||
"options" : {
|
||||
"enum_titles" : ["edt_conf_enum_bbdefault", "edt_conf_enum_bbclassic", "edt_conf_enum_bbosd"]
|
||||
"enum_titles" : ["edt_conf_enum_bbdefault", "edt_conf_enum_bbclassic", "edt_conf_enum_bbosd", "edt_conf_enum_bbletterbox"]
|
||||
},
|
||||
"propertyOrder" : 7
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user