VOXL OpenVINS Server 1.0
Visual Inertial Odometry Server for VOXL Platform
Loading...
Searching...
No Matches
MonoCameraMinimal.h
Go to the documentation of this file.
1/**
2 * @file MonoCameraMinimal.h
3 * @brief Monocular camera implementation for VOXL OpenVINS
4 * @author Zauberflote
5 * @date 2025
6 * @version 1.0
7 *
8 * This header defines the MonoCamera class, which specializes the CameraBase
9 * for monocular camera configurations. It handles single camera image processing
10 * and integration with the VIO system.
11 */
12
13#ifndef MONOCAMERAMINIMAL_H
14#define MONOCAMERAMINIMAL_H
15#pragma once
16#include "CameraBase.h"
17#include "CameraQueueFusion.h"
18#include "VoxlVars.h"
19#include <iostream>
20#include <opencv2/opencv.hpp>
21#include <deque>
22#include <optional>
23#include <cstdint>
24
25namespace voxl
26{
27
28 /**
29 * @class MonoCamera
30 * @brief Handles monocular camera input
31 *
32 * This class specializes CameraBase for monocular camera configurations.
33 * It processes images from a single camera and feeds them to the VIO system.
34 *
35 * The MonoCamera class provides:
36 * - Single camera image processing
37 * - RAW8 format support
38 * - ION buffer processing
39 * - Queue-based data management
40 * - System state awareness
41 *
42 * Key features:
43 * - Inherits from CameraBase for common functionality
44 * - Implements specific image processing for monocular setups
45 * - Integrates with the camera queue fusion system
46 * - Handles various image formats and buffer types
47 */
48 class MonoCamera : public CameraBase
49 {
50 public:
51 /**
52 * @brief Constructor
53 * @param camera_info Camera configuration information
54 */
55 explicit MonoCamera(const cam_info &camera_info);
56
57 /**
58 * @brief Destructor
59 */
60 ~MonoCamera() override = default;
61
62 protected:
63 /**
64 * @brief Process incoming image data
65 *
66 * Overrides the base class method to handle monocular camera-specific
67 * image processing. This method is called by the pipe callback when
68 * new image data arrives.
69 *
70 * @param meta Image metadata containing timestamp and format information
71 * @param frame Pointer to image data buffer
72 */
73 void process_image(const camera_image_metadata_t &meta, voxl::ImageType type, void *frame) override;
74
75 private:
76 /**
77 * @brief Process RAW8 image format
78 *
79 * Handles the processing of RAW8 format images, which is a common
80 * format for monochrome cameras used in VIO systems.
81 *
82 * @param meta Image metadata
83 * @param frame Pointer to image data
84 */
85 void process_raw8(const camera_image_metadata_t &meta, char *frame);
86
87 /**
88 * @brief Process RAW8 image format from device
89 *
90 * Handles the RAW8 image format, accounting for the fact that the
91 * buffer pointer references memory on the device
92 *
93 * @param meta Image metdata
94 * @param frame Pointer to cl_mem image buffer
95 */
96 void process_device_buf_raw8(const camera_image_metadata_t &meta, cl_mem frame);
97
98 /**
99 * @brief Update mask based on current system state
100 *
101 * Efficiently updates the mask only when necessary, avoiding
102 * unnecessary allocations and copies.
103 *
104 * @param should_mask Whether the mask should be active
105 */
106 void update_mask_if_needed(bool should_mask);
107
108 /**
109 * @brief Check if system is in reset state
110 *
111 * Determines whether the VIO system is currently in a reset state,
112 * which affects how image processing should be handled.
113 *
114 * @return True if system is resetting, false otherwise
115 */
116 bool is_system_resetting() const;
117
118 /**
119 * @brief Check if system is ready to process images
120 *
121 * Determines whether the VIO system is ready to accept and process
122 * new image data.
123 *
124 * @return True if system is ready, false otherwise
125 */
126 bool is_system_ready() const;
127
128 /** @brief Current image height in pixels */
129 int current_height;
130
131 /** @brief Current image width in pixels */
132 int current_width;
133
134 /** @brief Current mask state to avoid unnecessary updates */
135 std::optional<bool> current_mask_state_;
136
137 /** @brief Flag indicating if mask dimensions have changed */
138 bool mask_dimensions_changed_{false};
139
140 /** @brief Flag indicating occlusion threshold has already been passed once */
141 bool occlusion_threshold_passed_{false};
142
143 /** @brief Timestamp of the last fully processed frame (ns) */
144 int64_t last_processed_ts_ns_{0};
145
146 /** @brief Minimum interval to process frames when static (ms) */
147 int throttle_static_min_interval_ms_{100};
148 };
149
150} // namespace voxl
151#endif // MONOCAMERAMINIMAL_H
Base class for camera implementations in VOXL OpenVINS.
Camera queue fusion system for VOXL OpenVINS.
Global variable declarations and constants for VOXL OpenVINS server.
Base class for all camera implementations.
Definition CameraBase.h:57
Handles monocular camera input.
~MonoCamera() override=default
Destructor.
void process_image(const camera_image_metadata_t &meta, voxl::ImageType type, void *frame) override
Process incoming image data.
Main namespace for VOXL OpenVINS server components.
Camera information and calibration data.
Definition VoxlCommon.h:198