Merge branch 'multi_colortransform'

Conflicts:
	CMakeLists.txt
	config/hyperion.config.json

Former-commit-id: 43d42e4fed479f60333b35bc092f9a55cd2ad8e8
This commit is contained in:
T. van der Zwan
2013-12-05 15:58:53 +00:00
31 changed files with 1890 additions and 403 deletions

View File

@@ -41,5 +41,9 @@ add_executable(test_blackborderprocessor
target_link_libraries(test_blackborderprocessor
hyperion)
add_executable(test_qregexp TestQRegExp.cpp)
target_link_libraries(test_qregexp
${QT_LIBRARIES})
add_executable(spidev_test spidev_test.c)
add_executable(gpio2spi switchPinCtrl.c)

View File

@@ -148,7 +148,7 @@ int main()
// Switch back (in one shot) to no border
assert(processor.process(noBorderImage));
assert(processor.getCurrentBorder().type == BlackBorder::none);
assert(processor.getCurrentBorder().verticalSize == 0 && processor.getCurrentBorder().horizontalSize == 0);
return 0;
}

View File

@@ -2,13 +2,14 @@
#include <iostream>
#include <cmath>
#include <utils/ColorTransform.h>
// Utils includes
#include <utils/RgbChannelTransform.h>
int main()
{
{
std::cout << "Testing linear transform" << std::endl;
ColorTransform t;
RgbChannelTransform t;
for (int i = 0; i < 256; ++i)
{
uint8_t input = i;
@@ -29,7 +30,7 @@ int main()
{
std::cout << "Testing threshold" << std::endl;
ColorTransform t(.10, 1.0, 0.0, 1.0);
RgbChannelTransform t(.10, 1.0, 0.0, 1.0);
for (int i = 0; i < 256; ++i)
{
uint8_t input = i;
@@ -50,7 +51,7 @@ int main()
{
std::cout << "Testing blacklevel and whitelevel" << std::endl;
ColorTransform t(0, 1.0, 0.2, 0.8);
RgbChannelTransform t(0, 1.0, 0.2, 0.8);
for (int i = 0; i < 256; ++i)
{
uint8_t input = i;
@@ -71,7 +72,7 @@ int main()
{
std::cout << "Testing gamma" << std::endl;
ColorTransform t(0, 2.0, 0.0, 1.0);
RgbChannelTransform t(0, 2.0, 0.0, 1.0);
for (int i = 0; i < 256; ++i)
{
uint8_t input = i;

50
test/TestQRegExp.cpp Normal file
View File

@@ -0,0 +1,50 @@
// STL includes
#include <iostream>
// QT includes
#include <QRegExp>
#include <QString>
#include <QStringList>
int main()
{
QString testString = "1-9, 11, 12,13,16-17";
QRegExp overallExp("([0-9]+(\\-[0-9]+)?)(,[ ]*([0-9]+(\\-[0-9]+)?))*");
{
std::cout << "[1] Match found: " << (overallExp.exactMatch("5")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("4-")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("-4")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("3-9")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("1-90")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("1-90,100")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("1-90, 100")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("1-90, 100-200")?"true":"false") << std::endl;
std::cout << "[1] Match found: " << (overallExp.exactMatch("1-90, 100-200, 100")?"true":"false") << std::endl;
}
{
if (!overallExp.exactMatch(testString)) {
std::cout << "No correct match" << std::endl;
return -1;
}
QStringList splitString = testString.split(QChar(','));
for (int i=0; i<splitString.size(); ++i) {
if (splitString[i].contains("-"))
{
QStringList str = splitString[i].split("-");
int startInd = str[0].toInt();
int endInd = str[1].toInt();
std::cout << "==> " << startInd << "-" << endInd << std::endl;
}
else
{
int index = splitString[i].toInt();
std::cout << "==> " << index << std::endl;
}
}
}
return 0;
}