Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
ea61970
to revert
awawa-dev Feb 4, 2024
c85ef1a
LUT rework
awawa-dev Feb 11, 2024
35c3d0b
Test images creator
awawa-dev Aug 12, 2024
1ab1a2c
Test video
awawa-dev Aug 13, 2024
a07a4cf
Use vectors
awawa-dev Aug 19, 2024
77826cc
Extract classes & namespaces
awawa-dev Aug 21, 2024
19503b0
Add CapturedColor
awawa-dev Aug 22, 2024
d005d7d
Optimize board creator
awawa-dev Aug 22, 2024
09e88aa
Make board verifier work
awawa-dev Aug 22, 2024
86dd611
Read CRC from the test board
awawa-dev Aug 22, 2024
97ec1ca
Parse and verify colors of all test boards
awawa-dev Aug 22, 2024
a026103
Print error stats
awawa-dev Aug 22, 2024
c573efd
Correction
awawa-dev Aug 22, 2024
17f0527
Calibration for new boards. 17*17*17 YUV samples.
awawa-dev Aug 23, 2024
db9bc92
Parse text HDR LUT to binary format
awawa-dev Aug 26, 2024
45b169a
Add save raw image
awawa-dev Aug 28, 2024
f2445c6
Const correction
awawa-dev Aug 28, 2024
ce88768
Add detection of bt.2020 gamma in the input data
awawa-dev Aug 30, 2024
71d4f13
Add more colorspace math
awawa-dev Aug 30, 2024
34b4aa7
More math
awawa-dev Aug 30, 2024
3b2a260
Update LutCalibrator.cpp
awawa-dev Aug 31, 2024
4fff3a6
Verify source: only NV12/YUYV/MJPEG source are supported for the cali…
awawa-dev Aug 31, 2024
b766491
Add precise scanner
awawa-dev Sep 2, 2024
c873b87
Testing more conditions and deviation of YUV coefs
awawa-dev Sep 3, 2024
90ee566
Optimize matrix multiplication
awawa-dev Sep 4, 2024
32f133a
Extract methods
awawa-dev Sep 4, 2024
ae75b4a
Optimize YUV coef matrix creation
awawa-dev Sep 4, 2024
7f84ef6
Implemented LUT saving
awawa-dev Sep 4, 2024
6fd5447
Add support for Flatbuffers NV12 calibration
awawa-dev Sep 4, 2024
0106566
Save captured YUV colors in HyperHDR home folder
awawa-dev Sep 4, 2024
60f4673
HDR10 calibration is working again also using video test files
awawa-dev Sep 4, 2024
9999d18
Fix errors (1)
awawa-dev Sep 4, 2024
09c499d
Test C++17
awawa-dev Sep 4, 2024
4de0544
Fix errors (2)
awawa-dev Sep 4, 2024
4e82cc8
HDR10 calibrator: fix errors
awawa-dev Sep 4, 2024
1b0020a
HDR10 calibration is working again also using video test files
awawa-dev Sep 4, 2024
5c95eac
HDR10 calibration is working again also using video test files
awawa-dev Sep 4, 2024
7130cd0
Added a new nice web wizard for LUT calibration
awawa-dev Sep 5, 2024
0864fe9
Added BT.2100 HLG support
awawa-dev Sep 8, 2024
37bd1d0
Added BT.2100 HLG support (2)
awawa-dev Sep 8, 2024
edd58ff
Added BT.2100 HLG support (3)
awawa-dev Sep 8, 2024
bbb08e3
Added BT.2100 HLG support (4)
awawa-dev Sep 8, 2024
280e0b8
Verify if BT.2100 HLG OOTF is present
awawa-dev Sep 9, 2024
f0c2499
More detailed scan
awawa-dev Sep 9, 2024
205ebe0
Faster HLG OOTF when disabled
awawa-dev Sep 10, 2024
96544ac
More precise calculation
awawa-dev Sep 12, 2024
6c28e42
Fix calibration for 1280x720 capturing setting
awawa-dev Sep 12, 2024
b1c3fbb
Support for SDR calibration
awawa-dev Sep 13, 2024
7832376
More precise color capture saving/loading
awawa-dev Sep 15, 2024
a42d5d9
Add support for SDR (BT2020 in SRGB) calibration
awawa-dev Sep 17, 2024
8f48dce
Grabber benchmark support for flatbuffers
awawa-dev Sep 21, 2024
6d37f16
Add quarter of frame mode for flatbuffers
awawa-dev Sep 23, 2024
fde0461
Improvements
awawa-dev Sep 25, 2024
3acbc6e
Fix
awawa-dev Oct 2, 2024
4cb189a
Important calibration fix and stronger noise resistance
awawa-dev Oct 3, 2024
cd18e3c
Wider search
awawa-dev Oct 5, 2024
8b87274
Two stage calibration
awawa-dev Oct 6, 2024
bebe0f5
Refactoring
awawa-dev Oct 6, 2024
74ddbe4
Improvements
awawa-dev Oct 7, 2024
33a3391
Focus on yellow,scan more vertexes,error may go up
awawa-dev Oct 8, 2024
f268004
Improvements
awawa-dev Oct 8, 2024
8d6d2a1
Improvements
awawa-dev Oct 8, 2024
882b33f
Multi-threading support for LUT calibration
awawa-dev Oct 10, 2024
a7262bc
Multi-threading support for LUT creator
awawa-dev Oct 10, 2024
b218007
Add 'detailed calibration' option
awawa-dev Oct 10, 2024
0d0d3c6
Add LCH color correction
awawa-dev Oct 15, 2024
c5832c2
Run calibrator on separate thread (nonblocking UI)
awawa-dev Oct 16, 2024
d4e5682
Add PQ in sRGB linear signal detection
awawa-dev Oct 16, 2024
838663d
Pause grabber/flatbuffers while calibrating LUT
awawa-dev Oct 17, 2024
542afda
Change rounding for backlight
awawa-dev Oct 21, 2024
9e75efe
Fix serial port discovery in UI
awawa-dev Oct 23, 2024
a74b418
Added 3'th LCH layer, increased number of vertices, more CPU needed
awawa-dev Oct 25, 2024
4cb7d44
Add more test vertexes (959), change to square errors
awawa-dev Oct 26, 2024
fc59a9f
Add more brown color vertexes
awawa-dev Oct 26, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Grabber benchmark support for flatbuffers
  • Loading branch information
awawa-dev committed Sep 22, 2024
commit 8f48dcefbdebf0aa995acf22b2f302adef042610
7 changes: 1 addition & 6 deletions include/base/Grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ class Grabber : public DetectionAutomatic, public DetectionManual, protected Lut

void setSignalDetectionEnable(bool enable);

void setAutoSignalDetectionEnable(bool enable);

void benchmarkCapture(int status, QString message);
void setAutoSignalDetectionEnable(bool enable);

QList<Grabber::DevicePropertiesItem> getVideoDeviceModesFullInfo(const QString& devicePath);

Expand Down Expand Up @@ -270,9 +268,6 @@ public slots:
bool _signalDetectionEnabled;
bool _signalAutoDetectionEnabled;
QSemaphore _synchro;

int _benchmarkStatus;
QString _benchmarkMessage;
};

bool sortDevicePropertiesItem(const Grabber::DevicePropertiesItem& v1, const Grabber::DevicePropertiesItem& v2);
3 changes: 0 additions & 3 deletions include/base/GrabberWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public slots:
void stop();
void revive();

void benchmarkCapture(int status, QString message);

QJsonObject getJsonInfo();

QJsonDocument startCalibration();
Expand All @@ -57,7 +55,6 @@ private slots:
void SignalNewVideoImage(const QString& name, const Image<ColorRgb>& image);
void SignalVideoStreamChanged(QString device, QString videoMode);
void SignalCecKeyPressed(int key);
void SignalBenchmarkUpdate(int status, QString message);
void SignalInstancePauseChanged(int instance, bool isEnabled);
void SignalSetNewComponentStateToAllInstances(hyperhdr::Components component, bool enable);
void SignalSaveCalibration(QString saveData);
Expand Down
5 changes: 5 additions & 0 deletions include/base/HyperHdrManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#endif

#include <image/ColorRgb.h>
#include <utils/VideoBenchmark.h>
#include <utils/Logger.h>
#include <utils/settings.h>
#include <utils/Components.h>
Expand Down Expand Up @@ -101,6 +102,9 @@ public slots:

void SignalInstancePauseChanged(int instance, bool isEnabled);

void SignalBenchmarkUpdate(int status, QString message);
void SignalBenchmarkCapture(int status, QString message);

private slots:
void handleInstanceJustStarted();

Expand All @@ -126,4 +130,5 @@ private slots:
int _fireStarter;

QMap<quint8, PendingRequests> _pendingRequests;
VideoBenchmark _videoBenchmark;
};
5 changes: 3 additions & 2 deletions include/lut-calibrator/BoardUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ namespace BoardUtils
bool isCaptured(int index) const;
bool areAllCaptured();
void finilizeBoard();
void correctYRange(double3& yuv);
static void correctYRange(double3& yuv, double yRange, double upYLimit, double downYLimit, double yShift);
void getSignalParams(double& yRange, double& upYLimit, double& downYLimit, double& yShift);
void setCaptured(int index);
void setRange(YuvConverter::COLOR_RANGE range);
YuvConverter::COLOR_RANGE getRange() const;
bool saveResult(const char* filename = "D:/result.txt");
bool saveResult(const char* filename = "D:/result.txt", const std::string& result = "");
};
};
14 changes: 14 additions & 0 deletions include/lut-calibrator/ColorSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,19 @@ namespace ColorSpaceMath
QString matToString(double4x4 m);

QString matToString(double3x3 m);



void serialize(std::stringstream& out, const double2& v);

void serialize(std::stringstream& out, const double3& v);

void serialize(std::stringstream& out, const double4& v);


void serialize(std::stringstream& out, const double4x4& m);

void serialize(std::stringstream& out, const double3x3& m);

};

3 changes: 2 additions & 1 deletion include/lut-calibrator/LutCalibrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public slots:
void notifyCalibrationMessage(QString message, bool started = false);
void error(QString message);
void handleImage(const Image<ColorRgb>& image);
linalg::vec<double, 3> hdr_to_srgb(linalg::vec<double, 3> yuv, const linalg::vec<uint8_t, 2>& UV, const linalg::vec<double, 3>& aspect, const linalg::mat<double, 4, 4>& coefMatrix, ColorSpaceMath::HDR_GAMMA gamma, double gammaHLG, double nits, int altConvert, const linalg::mat<double, 3, 3>& bt2020_to_sRgb, int tryBt2020Range);
void scoreBoard(bool testOnly, const linalg::mat<double, 4, 4>& coefMatrix, ColorSpaceMath::HDR_GAMMA gamma, double gammaHLG, double nits, linalg::vec<double, 3> aspect, int tryBt2020Range, int altConvert, const linalg::mat<double, 3, 3>& bt2020_to_sRgb, const long long int& minError, long long int& currentError);
void tryHDR10();
void setupWhitePointCorrection();
Expand All @@ -100,6 +99,8 @@ public slots:
void capturedPrimariesCorrection(ColorSpaceMath::HDR_GAMMA gamma, double gammaHLG, double nits, int coef, linalg::mat<double, 3, 3>& convert_bt2020_to_XYZ, linalg::mat<double, 3, 3>& convert_XYZ_to_corrected, bool printDebug = false);
bool parseTextLut2binary(const char* filename = "D:/interpolated_lut.txt", const char* outfile = "D:/lut_lin_tables.3d");

static QString writeLUT(Logger* _log, QString _rootPath, BestResult* bestResult);

Logger* _log;
std::shared_ptr<BoardUtils::CapturedColors> _capturedColors;
std::shared_ptr<YuvConverter> _yuvConverter;
Expand Down
57 changes: 57 additions & 0 deletions include/utils/VideoBenchmark.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

/* VideoBenchmark.h
*
* MIT License
*
* Copyright (c) 2020-2024 awawa-dev
*
* Project homesite: https://github.com/awawa-dev/HyperHDR
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#ifndef PCH_ENABLED
#include <QObject>
#include <QString>
#endif

#include <image/Image.h>
#include <utils/Components.h>

class VideoBenchmark : public QObject
{
Q_OBJECT

int _benchmarkStatus;
QString _benchmarkMessage;
bool _connected;

public:
VideoBenchmark(QObject* parent);

public slots:
void signalSetGlobalImageHandler(int priority, const Image<ColorRgb>& image, int timeout_ms, hyperhdr::Components origin, QString clientDescription);
void signalNewVideoImageHandler(const QString& name, const Image<ColorRgb>& image);
void benchmarkCapture(int status, QString message);
void newFrame(const Image<ColorRgb>& image);

signals:
void SignalBenchmarkUpdate(int status, QString message);
};
6 changes: 3 additions & 3 deletions sources/api/CallbackAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ bool CallbackAPI::subscribeFor(const QString& type, bool unsubscribe)
connect(_accessManager.get(), &AccessManager::SignalTokenUpdated, this, &CallbackAPI::tokenChangeHandler, Qt::UniqueConnection);
}

if (type == "benchmark-update" && grabberWrapper != nullptr)
if (type == "benchmark-update")
{
if (unsubscribe)
disconnect(grabberWrapper, &GrabberWrapper::SignalBenchmarkUpdate, this, &CallbackAPI::signalBenchmarkUpdateHandler);
disconnect(_instanceManager.get(), &HyperHdrManager::SignalBenchmarkUpdate, this, &CallbackAPI::signalBenchmarkUpdateHandler);
else
connect(grabberWrapper, &GrabberWrapper::SignalBenchmarkUpdate, this, &CallbackAPI::signalBenchmarkUpdateHandler, Qt::UniqueConnection);
connect(_instanceManager.get(), &HyperHdrManager::SignalBenchmarkUpdate, this, &CallbackAPI::signalBenchmarkUpdateHandler, Qt::UniqueConnection);
}

return true;
Expand Down
14 changes: 2 additions & 12 deletions sources/api/HyperAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,18 +528,8 @@ void HyperAPI::handleBenchmarkCommand(const QJsonObject& message, const QString&
GrabberWrapper* grabberWrapper = (_videoGrabber != nullptr) ? _videoGrabber->grabberWrapper() : nullptr;
const QString& subc = message["subcommand"].toString().trimmed();
int status = message["status"].toInt();

if (grabberWrapper != nullptr)
{
if (subc == "ping")
{
emit grabberWrapper->SignalBenchmarkUpdate(status, "pong");
}
else
{
BLOCK_CALL_2(grabberWrapper, benchmarkCapture, int, status, QString, subc);
}
}

emit _instanceManager->SignalBenchmarkCapture(status, subc);

sendSuccessReply(command, tan);
}
Expand Down
25 changes: 1 addition & 24 deletions sources/base/Grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ Grabber::Grabber(const QString& configurationPath, const QString& grabberName)
, _signalDetectionEnabled(false)
, _signalAutoDetectionEnabled(false)
, _synchro(1)
, _benchmarkStatus(-1)
, _benchmarkMessage("")
{
connect(GlobalSignals::getInstance(), &GlobalSignals::SignalSetLut, this, &Grabber::signalSetLutHandler, Qt::BlockingQueuedConnection);
}
Expand Down Expand Up @@ -824,33 +822,12 @@ void Grabber::handleNewFrame(unsigned int workerIndex, Image<ColorRgb> image, qu
{
if (checkSignalDetectionManual(image))
emit GlobalSignals::getInstance()->SignalNewVideoImage(_deviceName, image);
}
if (_benchmarkStatus >= 0)
{
ColorRgb pixel = image(image.width() / 2, image.height() / 2);
if ((_benchmarkMessage == "white" && pixel.red > 120 && pixel.green > 120 && pixel.blue > 120) ||
(_benchmarkMessage == "red" && pixel.red > 120 && pixel.green < 30 && pixel.blue < 30) ||
(_benchmarkMessage == "green" && pixel.red < 30 && pixel.green > 120 && pixel.blue < 30) ||
(_benchmarkMessage == "blue" && pixel.red < 30 && pixel.green < 40 && pixel.blue > 120) ||
(_benchmarkMessage == "black" && pixel.red < 30 && pixel.green < 30 && pixel.blue < 30))

{
emit SignalBenchmarkUpdate(_benchmarkStatus, _benchmarkMessage);
_benchmarkStatus = -1;
_benchmarkMessage = "";
}
}
}
}
else
frameStat.directAccess = true;
}

void Grabber::benchmarkCapture(int status, QString message)
{
_benchmarkStatus = status;
_benchmarkMessage = message;
}

bool Grabber::isInitialized()
{
return _initialized;
Expand Down
8 changes: 0 additions & 8 deletions sources/base/GrabberWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,6 @@ void GrabberWrapper::revive()
QTimer::singleShot(3000, _grabber.get(), &Grabber::revive);
}

void GrabberWrapper::benchmarkCapture(int status, QString message)
{
if (_grabber != nullptr)
{
_grabber->benchmarkCapture(status, message);
}
}

bool GrabberWrapper::getAutoResume()
{
return _autoResume;
Expand Down
4 changes: 4 additions & 0 deletions sources/base/HyperHdrManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ HyperHdrManager::HyperHdrManager(const QString& rootPath)
, _instanceTable(new InstanceTable())
, _rootPath(rootPath)
, _fireStarter(0)
, _videoBenchmark(this)
{
qRegisterMetaType<InstanceState>("InstanceState");
connect(this, &HyperHdrManager::SignalInstanceStateChanged, this, &HyperHdrManager::handleInstanceStateChange);

connect(&_videoBenchmark, &VideoBenchmark::SignalBenchmarkUpdate, this, &HyperHdrManager::SignalBenchmarkUpdate);
connect(this, &HyperHdrManager::SignalBenchmarkCapture, &_videoBenchmark, &VideoBenchmark::benchmarkCapture);
}

HyperHdrManager::~HyperHdrManager()
Expand Down
2 changes: 1 addition & 1 deletion sources/grabber/linux/v4l2/V4L2Grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ bool V4L2Grabber::process_image(v4l2_buffer* buf, const void* frameImageBuffer,
loadLutFile();
}

bool directAccess = !(_signalAutoDetectionEnabled || _signalDetectionEnabled || isCalibrating() || (_benchmarkStatus >= 0));
bool directAccess = !(_signalAutoDetectionEnabled || _signalDetectionEnabled || isCalibrating() );
_workerThread->setup(
i,
buf,
Expand Down
1 change: 0 additions & 1 deletion sources/grabber/linux/v4l2/V4L2Wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ V4L2Wrapper::V4L2Wrapper(const QString& device,
: GrabberWrapper("V4L2:" + device.left(14))
{
_grabber = std::unique_ptr<Grabber>(new V4L2Grabber(device, configurationPath));
connect(_grabber.get(), &Grabber::SignalBenchmarkUpdate, this, &GrabberWrapper::SignalBenchmarkUpdate);
connect(_grabber.get(), &Grabber::SignalCapturingException, this, &GrabberWrapper::capturingExceptionHandler);
connect(_grabber.get(), &Grabber::SignalSetNewComponentStateToAllInstances, this, &GrabberWrapper::SignalSetNewComponentStateToAllInstances);
connect(_grabber.get(), &Grabber::SignalSaveCalibration, this, &GrabberWrapper::SignalSaveCalibration);
Expand Down
2 changes: 1 addition & 1 deletion sources/grabber/osx/AVF/AVFGrabber.mm
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ - (void)captureOutput:(AVCaptureOutput *)output didOutputSampleBuffer:(CMSampleB
loadLutFile();
}

bool directAccess = !(_signalAutoDetectionEnabled || _signalDetectionEnabled || isCalibrating() || (_benchmarkStatus >= 0));
bool directAccess = !(_signalAutoDetectionEnabled || _signalDetectionEnabled || isCalibrating());
_workerThread->setup(
i,
_actualVideoFormat,
Expand Down
1 change: 0 additions & 1 deletion sources/grabber/osx/AVF/AVFWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ AVFWrapper::AVFWrapper(const QString& device,
: GrabberWrapper("macOS AVF:" + device.left(14))
{
_grabber = std::unique_ptr<Grabber>(new AVFGrabber(device, configurationPath));
connect(_grabber.get(), &Grabber::SignalBenchmarkUpdate, this, &GrabberWrapper::SignalBenchmarkUpdate);
connect(_grabber.get(), &Grabber::SignalCapturingException, this, &GrabberWrapper::capturingExceptionHandler);
connect(_grabber.get(), &Grabber::SignalSetNewComponentStateToAllInstances, this, &GrabberWrapper::SignalSetNewComponentStateToAllInstances);
connect(_grabber.get(), &Grabber::SignalSaveCalibration, this, &GrabberWrapper::SignalSaveCalibration);
Expand Down
2 changes: 1 addition & 1 deletion sources/grabber/windows/MF/MFGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ bool MFGrabber::process_image(const void* frameImageBuffer, int size)
loadLutFile();
}

bool directAccess = !(_signalAutoDetectionEnabled || _signalDetectionEnabled || isCalibrating() || (_benchmarkStatus >= 0));
bool directAccess = !(_signalAutoDetectionEnabled || _signalDetectionEnabled || isCalibrating());
_workerThread->setup(
i,
_actualVideoFormat,
Expand Down
1 change: 0 additions & 1 deletion sources/grabber/windows/MF/MFWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ MFWrapper::MFWrapper(const QString& device,
: GrabberWrapper("Media Foundation:" + device.left(14))
{
_grabber = std::unique_ptr<Grabber>(new MFGrabber(device, configurationPath));
connect(_grabber.get(), &Grabber::SignalBenchmarkUpdate, this, &GrabberWrapper::SignalBenchmarkUpdate);
connect(_grabber.get(), &Grabber::SignalCapturingException, this, &GrabberWrapper::capturingExceptionHandler);
connect(_grabber.get(), &Grabber::SignalSetNewComponentStateToAllInstances, this, &GrabberWrapper::SignalSetNewComponentStateToAllInstances);
connect(_grabber.get(), &Grabber::SignalSaveCalibration, this, &GrabberWrapper::SignalSaveCalibration);
Expand Down
18 changes: 14 additions & 4 deletions sources/lut-calibrator/BoardUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,17 @@ namespace BoardUtils
_upYLimit = all[SCREEN_COLOR_DIMENSION - 1][SCREEN_COLOR_DIMENSION - 1][SCREEN_COLOR_DIMENSION - 1].y();
}

void CapturedColors::correctYRange(double3& yuv)
void CapturedColors::correctYRange(double3& yuv, double yRange, double upYLimit, double downYLimit, double yShift)
{
yuv.x = ((yuv.x - _downYLimit) / (_upYLimit - _downYLimit)) * _yRange + _yShift;
yuv.x = ((yuv.x - downYLimit) / (upYLimit - downYLimit)) * yRange + yShift;
}

void CapturedColors::getSignalParams(double& yRange, double& upYLimit, double& downYLimit, double& yShift)
{
yRange = _yRange;
upYLimit = _upYLimit;
downYLimit = _downYLimit;
yShift = _yShift;
}

void CapturedColors::setCaptured(int index)
Expand All @@ -439,7 +447,7 @@ namespace BoardUtils
return _range;
}

bool CapturedColors::saveResult(const char* filename)
bool CapturedColors::saveResult(const char* filename, const std::string& result)
{
std::ofstream myfile;
myfile.open(filename, std::ios::trunc | std::ios::out);
Expand All @@ -451,7 +459,7 @@ namespace BoardUtils

myfile << "// Values of the table represent YUV in range [0 - 1] * " << std::to_string(IMPORT_SCALE) << ", limited of full" << std::endl;
myfile << "// Each row of the " << std::to_string(SCREEN_COLOR_DIMENSION) <<"^3 table consist of the following RGB coordinates:" << std::endl << "// [ ";

for (int i = 0, j = 0; i < SCREEN_COLOR_DIMENSION; i++, j += SCREEN_COLOR_STEP)
{
if (i)
Expand All @@ -461,6 +469,8 @@ namespace BoardUtils

myfile << " ]" << std::endl << "// First table is in Python format, second in C++ format" << std::endl << std::endl;

myfile << result;

for(const auto& currentArray : arrayMark)
{
myfile << currentArray.first << std::endl;
Expand Down
Loading