mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Added simple test for image2led map.
Added test executable for creating png from frame grabber. Added test-device for exporting color values of leds to text file. Updated configuration to match new color transform. Finished first version of the Hyperion structure (IT WORKS [1% CPU]!)
This commit is contained in:
44
test/TestImage2LedsMap.cpp
Normal file
44
test/TestImage2LedsMap.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
// Utils includes
|
||||
#include <utils/RgbImage.h>
|
||||
#include <utils/jsonschema/JsonFactory.h>
|
||||
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
#include <hyperion/ImageToLedsMap.h>
|
||||
|
||||
using namespace hyperion;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string homeDir = getenv("RASPILIGHT_HOME");
|
||||
|
||||
const std::string schemaFile = homeDir + "/hyperion.schema.json";
|
||||
const std::string configFile = homeDir + "/hyperion.config.json";
|
||||
|
||||
Json::Value config;
|
||||
if (JsonFactory::load(schemaFile, configFile, config) < 0)
|
||||
{
|
||||
std::cerr << "UNABLE TO LOAD CONFIGURATION" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const LedString ledString = Hyperion::createLedString(config["leds"]);
|
||||
|
||||
const RgbColor testColor = {64, 123, 12};
|
||||
|
||||
RgbImage image(64, 64, testColor);
|
||||
ImageToLedsMap map(64, 64, ledString.leds());
|
||||
|
||||
std::vector<RgbColor> ledColors(ledString.leds().size());
|
||||
map.getMeanLedColor(image, ledColors);
|
||||
|
||||
std::cout << "[";
|
||||
for (const RgbColor & color : ledColors)
|
||||
{
|
||||
std::cout << color;
|
||||
}
|
||||
std::cout << "]" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user