From 459fe70f53b2f3a7dc33c3833210f60840a23204 Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Thu, 23 Jan 2025 15:49:39 +0100 Subject: change img data type to uint8_t, fix loading of bin calibration table --- main.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 7bde680..19108d0 100644 --- a/main.cpp +++ b/main.cpp @@ -110,6 +110,12 @@ void onNewPixels( // qDebug() << __func__ << "got empty pixels"; } + for (size_t i = 640 - 5; i < 640 + 5; i++) { + // std::cout << pixels->pixels[i] << " "; + } + + // std::cout << std::endl + ::pixels = *pixels; } @@ -144,7 +150,7 @@ int main(int argc, char* argv[]) // if (false) qDebug() << "size of raw profile" << sizeof(Pixels); - if (false) { + if (true) { // open binary calibration table if (true) { if (!openCalibrationTable("/home/user/dumps/binz.calibration_table", @@ -294,8 +300,7 @@ int main(int argc, char* argv[]) interpolate(::calibrationTableX); - if (!dump(::calibrationTableZ, - "/home/user/dumps/binx.calibration_table")) { + if (!dump(::calibrationTableX, "/home/user/dumps/binx.calibration_table")) { qApp->exit(EXIT_FAILURE); } @@ -305,6 +310,14 @@ int main(int argc, char* argv[]) } } + QCryptographicHash hashZ(QCryptographicHash::Sha256); + hashZ.addData(QByteArrayView((char *) ::calibrationTableZ.data(), sizeof(CalibrationTable))); + qDebug() << "hash z" << sizeof(::calibrationTableZ) << hashZ.result().toHex(); + + QCryptographicHash hashX(QCryptographicHash::Sha256); + hashX.addData(QByteArrayView((char *) ::calibrationTableX.data(), sizeof(CalibrationTable))); + qDebug() << "hash x" << sizeof(::calibrationTableX) << hashX.result().toHex(); + // exit(EXIT_SUCCESS); // if (!initLaser()) { @@ -353,7 +366,10 @@ int main(int argc, char* argv[]) QHttpServer qHttpServer; qHttpServer.route("/v1/sensor/image", [&]() { std::cout << "http: image" << std::endl << std::flush; + // FILE *f = fopen("/tmp/img.pgm", "w"); + // static bool save = false; pgm_save(::img); + // save = false; std::lock_guard lg(pgm_image_mtx); qDebug() << "mutex locked"; qDebug() << "image saved to array"; -- cgit v1.2.3-70-g09d2