2013-08-15 21:11:02 +02:00
|
|
|
|
|
|
|
// Utils includes
|
2013-11-11 10:00:37 +01:00
|
|
|
#include <utils/Image.h>
|
2016-09-25 21:59:31 +02:00
|
|
|
#include <utils/jsonschema/QJsonFactory.h>
|
2013-08-15 21:11:02 +02:00
|
|
|
|
|
|
|
// Hyperion includes
|
2019-02-03 14:36:57 +01:00
|
|
|
#include <utils/hyperion.h>
|
2013-08-15 21:11:02 +02:00
|
|
|
#include <hyperion/ImageToLedsMap.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2023-01-16 12:01:28 +01:00
|
|
|
const QString schemaFile = ":/hyperion-schema";
|
|
|
|
const QString configFile = ":/hyperion_default.config";
|
2013-08-15 21:11:02 +02:00
|
|
|
|
|
|
|
|
2016-09-25 21:59:31 +02:00
|
|
|
QJsonObject config;
|
|
|
|
if (QJsonFactory::load(schemaFile, configFile, config) < 0)
|
2013-08-15 21:11:02 +02:00
|
|
|
{
|
|
|
|
std::cerr << "UNABLE TO LOAD CONFIGURATION" << std::endl;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-02-03 14:36:57 +01:00
|
|
|
const LedString ledString = hyperion::createLedString(config["leds"].toArray(), hyperion::createColorOrder(config["device"].toObject()));
|
2013-08-15 21:11:02 +02:00
|
|
|
|
2013-11-11 10:00:37 +01:00
|
|
|
const ColorRgb testColor = {64, 123, 12};
|
2013-08-15 21:11:02 +02:00
|
|
|
|
2013-11-11 10:00:37 +01:00
|
|
|
Image<ColorRgb> image(64, 64, testColor);
|
2019-02-03 14:36:57 +01:00
|
|
|
hyperion::ImageToLedsMap map(64, 64, 0, 0, ledString.leds());
|
2013-08-15 21:11:02 +02:00
|
|
|
|
2013-11-11 10:00:37 +01:00
|
|
|
std::vector<ColorRgb> ledColors(ledString.leds().size());
|
2013-08-15 21:11:02 +02:00
|
|
|
map.getMeanLedColor(image, ledColors);
|
|
|
|
|
|
|
|
std::cout << "[";
|
2013-11-11 10:00:37 +01:00
|
|
|
for (const ColorRgb & color : ledColors)
|
2013-08-15 21:11:02 +02:00
|
|
|
{
|
|
|
|
std::cout << color;
|
|
|
|
}
|
|
|
|
std::cout << "]" << std::endl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|