Changed the image-to-leds map by using offset-pointing.

Moved the image-buffer from processor to dispmanx-wrapper.
Added timeout handling to Hyperion.
This commit is contained in:
T. van der Zwan
2013-08-14 15:02:09 +00:00
parent e8b97dcb01
commit b457c444f6
11 changed files with 136 additions and 94 deletions

View File

@@ -6,6 +6,7 @@
// Utils includes
#include <utils/RgbColor.h>
#include <utils/RgbImage.h>
// Forward class declaration
class DispmanxFrameGrabber;
@@ -42,6 +43,7 @@ private:
QTimer _timer;
RgbImage _image;
DispmanxFrameGrabber * _frameGrabber;
ImageProcessor * _processor;

View File

@@ -1,6 +1,10 @@
#pragma once
// QT includes
#include <QObject>
#include <QTimer>
// hyperion-utils includes
#include <utils/RgbImage.h>
@@ -13,8 +17,9 @@
namespace hyperion { class ColorTransform; }
class Hyperion
class Hyperion : public QObject
{
Q_OBJECT
public:
Hyperion(const Json::Value& jsonConfig);
@@ -24,6 +29,9 @@ public:
void setValue(int priority, std::vector<RgbColor> &ledColors, const int timeout_ms);
private slots:
void update();
private:
void applyTransform(std::vector<RgbColor>& colors) const;
@@ -36,4 +44,6 @@ private:
hyperion::ColorTransform* mBlueTransform;
LedDevice* mDevice;
QTimer _timer;
};

View File

@@ -21,18 +21,6 @@ class ImageProcessor
public:
~ImageProcessor();
/**
* Processes the image to a list of led colors. This will update the size of the buffer-image
* if required and call the image-to-leds mapping to determine the mean color per led.
*
* @param[in] image The image to translate to led values
*
* @return The color value per led
*/
std::vector<RgbColor> process(const RgbImage& image);
// 'IN PLACE' processing functions
/**
* Specifies the width and height of 'incomming' images. This will resize the buffer-image to
* match the given size.
@@ -44,19 +32,21 @@ public:
void setSize(const unsigned width, const unsigned height);
/**
* Returns a reference of the underlying image-buffer. This can be used to write data directly
* into the buffer, avoiding a copy inside the process method.
* Processes the image to a list of led colors. This will update the size of the buffer-image
* if required and call the image-to-leds mapping to determine the mean color per led.
*
* @return The reference of the underlying image-buffer.
* @param[in] image The image to translate to led values
*
* @return The color value per led
*/
RgbImage& image();
std::vector<RgbColor> process(const RgbImage& image);
/**
* Determines the led colors of the image in the buffer.
*
* @param[out] ledColors The color value per led
*/
void inplace_process(std::vector<RgbColor>& ledColors);
void process(const RgbImage& image, std::vector<RgbColor>& ledColors);
private:
friend class ImageProcessorFactory;
@@ -66,7 +56,6 @@ private:
private:
const LedString mLedString;
RgbImage *mBuffer;
hyperion::ImageToLedsMap* mImageToLeds;
};

View File

@@ -18,9 +18,9 @@ namespace Json { class Value; }
* <pre>
* |--------------------image--|
* | minX maxX |
* | |-----|maxY |
* | | | |
* | |-----|minY |
* | | | |
* | |-----|maxY |
* | |
* | |
* | |

View File

@@ -45,6 +45,10 @@ public:
return mColors;
}
const RgbColor* memptr() const
{
return mColors;
}
private:
inline unsigned toIndex(const unsigned x, const unsigned y) const