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:
T. van der Zwan
2013-08-15 19:11:02 +00:00
parent 2c6b48a54d
commit 4031a33f04
21 changed files with 504 additions and 5921 deletions

View File

@@ -23,14 +23,9 @@ add_executable(TestColorTransform
target_link_libraries(TestColorTransform
hyperion)
# Find the libPNG
find_package(PNG REQUIRED QUIET)
add_executable(TestImage2LedsMap
TestImage2LedsMap.cpp)
target_link_libraries(TestImage2LedsMap
hyperion)
# Add additional includes dirs
include_directories(${PNG_INCLUDE_DIR})
add_executable(TestHyperionPng
TestHyperionPng.cpp)
target_link_libraries(TestHyperionPng
hyperion-png)
add_subdirectory(dispmanx2png)

View 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;
}

View File

@@ -0,0 +1,18 @@
# Find the BCM-package (VC control)
find_package(BCM REQUIRED)
include_directories(${BCM_INCLUDE_DIRS})
# Configure the use of QT4
find_package(Qt4 COMPONENTS QtTest REQUIRED QUIET)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
link_directories(${CMAKE_FIND_ROOT_PATH}/lib/arm-linux-gnueabihf)
add_executable(dispmanx2png
dispmanx2png.cpp)
target_link_libraries(dispmanx2png
hyperion
${QT_LIBRARIES})

View File

@@ -0,0 +1,47 @@
// STL includes
#include <csignal>
// QT includes
#include <QImage>
#include <QTest>
// Hyperion includes
#include <hyperion/DispmanxFrameGrabber.h>
static bool running = true;
void signal_handler(int signum)
{
running = false;
}
int main()
{
signal(SIGTERM, signal_handler);
signal(SIGINT, signal_handler);
DispmanxFrameGrabber frameGrabber(64, 64);
unsigned iFrame = 0;
QImage qImage(64, 64, QImage::Format_RGB888);
RgbImage rgbImage(64, 64);
while(running)
{
frameGrabber.grabFrame(rgbImage);
for (int iScanline=0; iScanline<qImage.height(); ++iScanline)
{
unsigned char* scanLinePtr = qImage.scanLine(iScanline);
memcpy(scanLinePtr, rgbImage.memptr()+rgbImage.width()*iScanline, rgbImage.width()*sizeof(RgbColor));
}
qImage.save(QString("HYPERION_%3.png").arg(iFrame));
++iFrame;
QTest::qSleep(1000);
}
return 0;
}