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:
18
test/dispmanx2png/CMakeLists.txt
Normal file
18
test/dispmanx2png/CMakeLists.txt
Normal 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})
|
47
test/dispmanx2png/dispmanx2png.cpp
Normal file
47
test/dispmanx2png/dispmanx2png.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user