KDEAmbi/test_hyperion_processor.cpp

48 lines
1.4 KiB
C++

#include <QCoreApplication>
#include <QImage>
#include <QJsonObject>
#include <QVector>
#include <QColor>
#include <iostream>
#include "HyperionProcessor.h"
#include "LedColorMapping.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
// Load the test image
QImage testImage("frames/illustration-of-rainbow-colors-in-flat-style-vector.png");
if (testImage.isNull()) {
std::cerr << "Failed to load test image: frames/illustration-of-rainbow-colors-in-flat-style-vector.png" << std::endl;
return 1;
}
std::cout << "Loaded test image: " << testImage.width() << "x" << testImage.height() << std::endl;
// Define the LED layout
LedLayout layout;
layout.bottom = 70;
layout.right = 20;
layout.top = 70;
layout.left = 20;
// Define the processor configuration
QJsonObject config;
config["blackBorderThreshold"] = 0.1;
// Create the processor
HyperionProcessor processor(layout, config);
// Process the image
QVector<QColor> ledColors = processor.process(testImage);
// Print the results
std::cout << "Processing complete. Number of LED colors: " << ledColors.size() << std::endl;
for (int i = 0; i < ledColors.size(); ++i) {
const QColor& color = ledColors.at(i);
std::cout << "LED " << i << ": " << color.name().toStdString() << std::endl;
}
return 0;
}