diff options
| author | Nikita Kostovsky <nikita@kostovsky.me> | 2026-03-06 20:40:29 +0100 |
|---|---|---|
| committer | Nikita Kostovsky <nikita@kostovsky.me> | 2026-03-06 20:40:29 +0100 |
| commit | 05f0938a65c4f8c330791097680e1e094260bb60 (patch) | |
| tree | d11e48c96eed6de03c51b793081310d96dee8618 /src/profile.cpp | |
| parent | 051cb23a807a6914e2cda7e3b08d69ed29f347dd (diff) | |
refactoring
Diffstat (limited to 'src/profile.cpp')
| -rw-r--r-- | src/profile.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/profile.cpp b/src/profile.cpp index 64ba091..3ed11ba 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -11,33 +11,35 @@ Profile::Profile( const CalibrationTablePtr calibrationTableX) : m_counters(pixels.counters) { - if (!calibrationTableZ || !calibrationTableX) - { - std::cerr << __func__ << ": got invalid calibration tables" - << std::endl; + // if (!calibrationTableZ || !calibrationTableX) { + // std::cerr << __func__ << ": got invalid calibration tables" << std::endl; - return; - } + // return; + // } static bool done{false}; - if (!done) { - for (size_t i = 9471; i < 9472; i++) { - std::cout << __func__ << ": row #" << i << ": "; + // if (!done) { + // // for (size_t i = 9471; i < 9472; i++) { + // for (size_t i = 0; i < calibrationTableHeight; i++) { + // std::cout << __func__ << ": row #" << i << ": "; - for (size_t j = 0; j < img_width; ++j) { - const auto& x = calibrationTableX->at(j).at(i); - const auto& z = calibrationTableZ->at(j).at(i); - std::cout << "Profile: table: " << x << ' ' << z << std::endl; - } + // for (size_t j = 0; j < img_width; ++j) { + // const auto &x = calibrationTableX ? calibrationTableX->at(j).at(i) : j; + // const auto &z = calibrationTableZ->at(j).at(i); + // std::cout << "Profile: table: " << x << ' ' << z << std::endl; + // } - std::cout << std::endl; - } - } + // std::cout << std::endl; + // } + // } for (size_t i = 0; i < img_width; ++i) { try { const auto& pixel = pixels.pixels[i]; + if (!qFuzzyIsNull(pixel)) { + qt_noop(); + } const auto pixelDiscrete = pixel * discretesInRage / img_height; if (Q_UNLIKELY(pixel >= sizeof(CalibrationColumn) / sizeof(float))) { qWarning() << "got invalid calibration pixel at" << i << ":" @@ -79,8 +81,7 @@ Profile::Profile( // TODO: use only NaN (or zero?) everywhere // NOTE: QJsonValue converts NaN to zero if (qFuzzyIsNull(z) || std::isnan(z)) { - // qDebug() << "got nan z for discrete" << pixelDiscrete << leftMmZ - // << rightMmZ; + // qDebug() << "got nan z for discrete" << pixelDiscrete << leftMmZ << rightMmZ; m_pointsMm.at(i) = {std::nan(""), std::nan("")}; continue; } |
