added bottom right to osd mode

Former-commit-id: 3972abaf30d46558d310dbc5e2d164330e9a5b63
This commit is contained in:
wisc 2016-02-11 15:50:51 +01:00
parent cf34f45daa
commit 63ec2909eb
2 changed files with 19 additions and 14 deletions

View File

@ -1,3 +1,4 @@
//#include <iostream>
#pragma once #pragma once
// Utils includes // Utils includes
@ -82,10 +83,13 @@ namespace hyperion
int firstNonBlackXPixelIndex = -1; int firstNonBlackXPixelIndex = -1;
int firstNonBlackYPixelIndex = -1; int firstNonBlackYPixelIndex = -1;
width--; // remove 1 pixel to get end pixel index
height--;
// find first X pixel of the image // find first X pixel of the image
for (int x = 0; x < width33percent; ++x) for (int x = 0; x < width33percent; ++x)
{ {
const Pixel_T & color1 = image( (width - 1 - x), yCenter); // right side center line check const Pixel_T & color1 = image( (width - x), yCenter); // right side center line check
const Pixel_T & color2 = image(x, height33percent); const Pixel_T & color2 = image(x, height33percent);
const Pixel_T & color3 = image(x, height66percent); const Pixel_T & color3 = image(x, height66percent);
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
@ -98,7 +102,7 @@ namespace hyperion
// find first Y pixel of the image // find first Y pixel of the image
for (int y = 0; y < height33percent; ++y) for (int y = 0; y < height33percent; ++y)
{ {
const Pixel_T & color1 = image(xCenter, (height - 1 - y)); // bottom center line check const Pixel_T & color1 = image(xCenter, (height - y)); // bottom center line check
const Pixel_T & color2 = image(width33percent, y ); const Pixel_T & color2 = image(width33percent, y );
const Pixel_T & color3 = image(width66percent, y); const Pixel_T & color3 = image(width66percent, y);
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
@ -174,7 +178,8 @@ namespace hyperion
} }
// osd detection mode (find x then y at detected x to avoid changes by osd overlays) ///
/// osd detection mode (find x then y at detected x to avoid changes by osd overlays)
template <typename Pixel_T> template <typename Pixel_T>
BlackBorder process_osd(const Image<Pixel_T> & image) BlackBorder process_osd(const Image<Pixel_T> & image)
{ {
@ -184,20 +189,21 @@ namespace hyperion
int height = image.height(); int height = image.height();
int width33percent = width / 3; int width33percent = width / 3;
int height33percent = height / 3; int height33percent = height / 3;
// int width66percent = width33percent * 2;
int height66percent = height33percent * 2; int height66percent = height33percent * 2;
// int xCenter = width / 2;
int yCenter = height / 2; int yCenter = height / 2;
int firstNonBlackXPixelIndex = -1; int firstNonBlackXPixelIndex = -1;
int firstNonBlackYPixelIndex = -1; int firstNonBlackYPixelIndex = -1;
width--; // remove 1 pixel to get end pixel index
height--;
// find first X pixel of the image // find first X pixel of the image
int x; int x;
for (x = 0; x < width33percent; ++x) for (x = 0; x < width33percent; ++x)
{ {
const Pixel_T & color1 = image( (width - 1 - x), yCenter); // right side center line check const Pixel_T & color1 = image( (width - x), yCenter); // right side center line check
const Pixel_T & color2 = image(x, height33percent); const Pixel_T & color2 = image(x, height33percent);
const Pixel_T & color3 = image(x, height66percent); const Pixel_T & color3 = image(x, height66percent);
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
@ -210,11 +216,13 @@ namespace hyperion
// find first Y pixel of the image // find first Y pixel of the image
for (int y = 0; y < height33percent; ++y) for (int y = 0; y < height33percent; ++y)
{ {
const Pixel_T & color1 = image(x, (height - 1 - y)); // left side bottom check const Pixel_T & color1 = image(x, y );// left side top check
const Pixel_T & color2 = image(x, y );// left side top check const Pixel_T & color2 = image(x, (height - y)); // left side bottom check
const Pixel_T & color3 = image( (width - 1 - x), y); // right side top check const Pixel_T & color3 = image( (width - x), y); // right side top check
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) const Pixel_T & color4 = image( (width - x), (height - y)); // right side bottom check
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3) || !isBlack(color4))
{ {
// std::cout << "y " << y << " lt " << int(isBlack(color1)) << " lb " << int(isBlack(color2)) << " rt " << int(isBlack(color3)) << " rb " << int(isBlack(color4)) << std::endl;
firstNonBlackYPixelIndex = y; firstNonBlackYPixelIndex = y;
break; break;
} }

View File

@ -1,12 +1,9 @@
//*
#include <iostream> #include <iostream>
/* /*
#include <iomanip> #include <iomanip>
using std::cout;
using std::endl;
using std::setw; using std::setw;
using std::left;
//*/ //*/
// Blackborder includes // Blackborder includes
#include <blackborder/BlackBorderProcessor.h> #include <blackborder/BlackBorderProcessor.h>