Configurable blackborder threshold added

Former-commit-id: 95b77dee2869b41bf556e0e374bea3c5e4534e61
This commit is contained in:
johan
2014-01-20 20:46:38 +01:00
parent af08b9b5d0
commit a7110ec64c
15 changed files with 121 additions and 49 deletions

View File

@@ -53,7 +53,7 @@ public:
verifyBorder(image);
// Create a result vector and call the 'in place' functionl
std::vector<ColorRgb> colors = mImageToLeds->getMeanLedColor(image);
std::vector<ColorRgb> colors = _imageToLeds->getMeanLedColor(image);
// return the computed colors
return colors;
@@ -75,7 +75,7 @@ public:
verifyBorder(image);
// Determine the mean-colors of each led (using the existing mapping)
mImageToLeds->getMeanLedColor(image, ledColors);
_imageToLeds->getMeanLedColor(image, ledColors);
}
///
@@ -98,8 +98,10 @@ private:
/// given led-string specification
///
/// @param[in] ledString The led-string specification
/// @param[in] enableBlackBorderDetector Flag indicating if the blacborder detector should be enabled
/// @param[in] blackborderThreshold The threshold which the blackborder detector should use
///
ImageProcessor(const LedString &ledString, bool enableBlackBorderDetector);
ImageProcessor(const LedString &ledString, bool enableBlackBorderDetector, uint8_t blackborderThreshold);
///
/// Performs black-border detection (if enabled) on the given image
@@ -116,17 +118,17 @@ private:
const hyperion::BlackBorder border = _borderProcessor->getCurrentBorder();
// Clean up the old mapping
delete mImageToLeds;
delete _imageToLeds;
if (border.unknown)
{
// Construct a new buffer and mapping
mImageToLeds = new hyperion::ImageToLedsMap(image.width(), image.height(), 0, 0, mLedString.leds());
_imageToLeds = new hyperion::ImageToLedsMap(image.width(), image.height(), 0, 0, _ledString.leds());
}
else
{
// Construct a new buffer and mapping
mImageToLeds = new hyperion::ImageToLedsMap(image.width(), image.height(), border.horizontalSize, border.verticalSize, mLedString.leds());
_imageToLeds = new hyperion::ImageToLedsMap(image.width(), image.height(), border.horizontalSize, border.verticalSize, _ledString.leds());
}
std::cout << "CURRENT BORDER TYPE: unknown=" << border.unknown << " hor.size=" << border.horizontalSize << " vert.size=" << border.verticalSize << std::endl;
@@ -135,14 +137,14 @@ private:
private:
/// The Led-string specification
const LedString mLedString;
const LedString _ledString;
/// Flag the enables(true)/disabled(false) blackborder detector
bool _enableBlackBorderRemoval;
const bool _enableBlackBorderRemoval;
/// The processor for black border detection
hyperion::BlackBorderProcessor * _borderProcessor;
/// The mapping of image-pixels to leds
hyperion::ImageToLedsMap* mImageToLeds;
hyperion::ImageToLedsMap* _imageToLeds;
};