mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
check for black pixel at center x/y
Former-commit-id: d91f422f55638418d2517d91b1c925880d7ca448
This commit is contained in:
parent
d5529e86df
commit
469ea42f49
@ -61,11 +61,51 @@ namespace hyperion
|
||||
template <typename Pixel_T>
|
||||
BlackBorder process(const Image<Pixel_T> & image)
|
||||
{
|
||||
|
||||
// only test the topleft third of the image
|
||||
int width = image.width() / 3;
|
||||
int height = image.height() / 3;
|
||||
int xCenter = image.width() / 2;
|
||||
int yCenter = image.height() / 2;
|
||||
// int maxSize = std::max(width, height);
|
||||
|
||||
|
||||
|
||||
int firstNonBlackXPixelIndex = -1;
|
||||
int firstNonBlackYPixelIndex = -1;
|
||||
|
||||
// find first X pixel of the image
|
||||
for (int x = 0; x < width; ++x)
|
||||
{
|
||||
const Pixel_T & color = image(x, yCenter);
|
||||
if (!isBlack(color))
|
||||
{
|
||||
firstNonBlackXPixelIndex = x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// find first Y pixel of the image
|
||||
for (int y = 0; y < height; ++y)
|
||||
{
|
||||
const Pixel_T & color = image(xCenter, y);
|
||||
if (!isBlack(color))
|
||||
{
|
||||
firstNonBlackYPixelIndex = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// only test the topleft third of the image
|
||||
int width = image.width() /3;
|
||||
int height = image.height() / 3;
|
||||
int maxSize = std::max(width, height);
|
||||
|
||||
|
||||
|
||||
int firstNonBlackXPixelIndex = -1;
|
||||
int firstNonBlackYPixelIndex = -1;
|
||||
|
||||
@ -103,6 +143,7 @@ namespace hyperion
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Construct result
|
||||
BlackBorder detectedBorder;
|
||||
|
Loading…
Reference in New Issue
Block a user