summaryrefslogtreecommitdiff
path: root/src/camera
diff options
context:
space:
mode:
Diffstat (limited to 'src/camera')
-rw-r--r--src/camera/icamera.h6
-rw-r--r--src/camera/veyeimx287m.cpp48
-rw-r--r--src/camera/veyeimx287m.h8
-rw-r--r--src/camera/veyeimx287m_types.h2
4 files changed, 61 insertions, 3 deletions
diff --git a/src/camera/icamera.h b/src/camera/icamera.h
index 94408b6..daee920 100644
--- a/src/camera/icamera.h
+++ b/src/camera/icamera.h
@@ -67,6 +67,12 @@ public:
[[nodiscard]] virtual std::optional<const std::chrono::microseconds> get_triggerExposureDelay()
= 0;
+ [[nodiscard]] virtual bool set_isBlackLevelManual(const bool manual) = 0;
+ [[nodiscard]] virtual std::optional<bool> get_isBlackLevelManual() = 0;
+
+ [[nodiscard]] virtual bool set_blackLevel(const uint32_t level) = 0;
+ [[nodiscard]] virtual std::optional<uint32_t> get_blackLevel() = 0;
+
[[nodiscard]] virtual std::shared_ptr<Image> getImage() = 0;
public:
diff --git a/src/camera/veyeimx287m.cpp b/src/camera/veyeimx287m.cpp
index 4556112..83ad32f 100644
--- a/src/camera/veyeimx287m.cpp
+++ b/src/camera/veyeimx287m.cpp
@@ -426,6 +426,7 @@ std::optional<float> VeyeIMX287m::get_gain()
bool VeyeIMX287m::set_triggerExposureDelay(const std::chrono::microseconds us)
{
using namespace veye::imx287m;
+ std::cout << __func__ << ": " << us << std::endl;
return m_i2c->write(static_cast<uint16_t>(Register::Trigger_Exp_Delay), us.count());
}
@@ -442,6 +443,49 @@ std::optional<const std::chrono::microseconds> VeyeIMX287m::get_triggerExposureD
return std::chrono::microseconds{*value};
}
+bool VeyeIMX287m::set_isBlackLevelManual(const bool manual)
+{
+ using namespace veye::imx287m;
+ std::cout << __func__ << ": " << manual << std::endl;
+ return m_i2c->write(static_cast<uint16_t>(Register::BLC_Mode),
+ static_cast<uint32_t>(manual
+ ? BlackLevelCalibrationMode::ManuallySpecified
+ : BlackLevelCalibrationMode::AutomaticOrDefault));
+}
+
+std::optional<bool> VeyeIMX287m::get_isBlackLevelManual()
+{
+ using namespace veye::imx287m;
+
+ const auto value = m_i2c->read(static_cast<uint32_t>(Register::BLC_Mode));
+
+ if (!value) {
+ return {};
+ }
+
+ return *value == static_cast<uint32_t>(BlackLevelCalibrationMode::ManuallySpecified);
+}
+
+bool VeyeIMX287m::set_blackLevel(const uint32_t level)
+{
+ using namespace veye::imx287m;
+ std::cout << __func__ << ": " << level << std::endl;
+ return m_i2c->write(static_cast<uint16_t>(Register::Black_Level), level);
+}
+
+std::optional<uint32_t> VeyeIMX287m::get_blackLevel()
+{
+ using namespace veye::imx287m;
+
+ const auto value = m_i2c->read(static_cast<uint32_t>(Register::Black_Level));
+
+ if (!value) {
+ return {};
+ }
+
+ return value;
+}
+
bool VeyeIMX287m::openCam()
{
m_cam_fd = open(videoDevice, O_RDWR);
@@ -739,7 +783,7 @@ void VeyeIMX287m::calcPixelsLoop(std::stop_token stopToken)
tmp.insert(tmp.begin(), p.cbegin(), p.cend());
}
// dumpCalibrationPixels(m_calibrationPixels);
- dumpCalibrationPixels(tmp, DumpFormat::Binary);
+ op::dumpCalibrationPixels(tmp, op::DumpFormat::Binary);
m_calibrationPixels.clear();
}
}
@@ -760,7 +804,7 @@ bool VeyeIMX287m::dequeueImageBuffer(size_t &imageIndex)
// TODO: move this shit to some beautiful place
if (elapsedTime > 1000. && processedCounter != 0) {
- if (false) {
+ if (true) {
fprintf(stderr,
"fps: %d\tdropped: %lu sec: %ld "
"dq: %lu get: %lu rot: %lu pix: %lu sum: %lu corr: "
diff --git a/src/camera/veyeimx287m.h b/src/camera/veyeimx287m.h
index 326a43a..764ede8 100644
--- a/src/camera/veyeimx287m.h
+++ b/src/camera/veyeimx287m.h
@@ -94,6 +94,12 @@ public:
[[nodiscard]] bool set_triggerExposureDelay(const std::chrono::microseconds us) override;
[[nodiscard]] std::optional<const std::chrono::microseconds> get_triggerExposureDelay() override;
+ [[nodiscard]] bool set_isBlackLevelManual(const bool manual) override;
+ [[nodiscard]] std::optional<bool> get_isBlackLevelManual() override;
+
+ [[nodiscard]] bool set_blackLevel(const uint32_t level) override;
+ [[nodiscard]] std::optional<uint32_t> get_blackLevel() override;
+
public:
/*!
* \brief processedCounter - count of images processed in current second.
@@ -161,7 +167,7 @@ private:
std::jthread m_getThreads[1];
// std::jthread m_getThreads[4];
// TODO: sync all loops somehow to guarantee frames order
- std::jthread m_rotateThreads[2];
+ std::jthread m_rotateThreads[1];
std::jthread m_calcPixelsThreads[1];
std::mutex m_lastImageMtx;
std::shared_ptr<Image> m_lastProcessedImage{};
diff --git a/src/camera/veyeimx287m_types.h b/src/camera/veyeimx287m_types.h
index 8cb74ba..a19a8ea 100644
--- a/src/camera/veyeimx287m_types.h
+++ b/src/camera/veyeimx287m_types.h
@@ -138,6 +138,8 @@ enum class GainMode : uint32_t {
AutoGainContinious = 2
};
+enum class BlackLevelCalibrationMode : uint32_t { AutomaticOrDefault = 0, ManuallySpecified = 1 };
+
class Params : public QObject
{
// Q_OBJECT