VOXL OpenVINS Server 0.7.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 Joao Leonardo Silva Cotta (@zauberflote1)
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 "VoxlVars.h"
18#include <iostream>
19#include <opencv2/opencv.hpp>
20#include <deque>
21#include <optional>
22#include <cstdint>
23
24namespace voxl
25{
26
27 /**
28 * @class MonoCamera
29 * @brief Handles monocular camera input
30 *
31 * This class specializes CameraBase for monocular camera configurations.
32 * It processes images from a single camera and feeds them to the VIO system.
33 *
34 * The MonoCamera class provides:
35 * - Single camera image processing
36 * - RAW8 format support
37 * - ION buffer processing
38 * - Queue-based data management
39 * - System state awareness
40 *
41 * Key features:
42 * - Inherits from CameraBase for common functionality
43 * - Implements specific image processing for monocular setups
44 * - Integrates with the camera queue fusion system
45 * - Handles various image formats and buffer types
46 */
47 class MonoCamera : public CameraBase
48 {
49 public:
50 /**
51 * @brief Constructor
52 * @param camera_info Camera configuration information
53 */
54 explicit MonoCamera(const cam_info &camera_info);
55
56 /**
57 * @brief Destructor
58 */
59 ~MonoCamera() override = default;
60
61 protected:
62 /**
63 * @brief Process incoming image data
64 *
65 * Overrides the base class method to handle monocular camera-specific
66 * image processing. This method is called by the pipe callback when
67 * new image data arrives.
68 *
69 * @param meta Image metadata containing timestamp and format information
70 * @param frame Pointer to image data buffer
71 */
72 void process_image(const camera_image_metadata_t &meta, voxl::ImageType type, void *frame) override;
73
74 private:
75 /**
76 * @brief Process RAW8 image format
77 *
78 * Handles the processing of RAW8 format images, which is a common
79 * format for monochrome cameras used in VIO systems.
80 *
81 * @param meta Image metadata
82 * @param frame Pointer to image data
83 */
84 void process_raw8(const camera_image_metadata_t &meta, char *frame);
85
86 /**
87 * @brief Process RAW8 image format from device
88 *
89 * Handles the RAW8 image format, accounting for the fact that the
90 * buffer pointer references memory on the device
91 *
92 * @param meta Image metdata
93 * @param frame Pointer to cl_mem image buffer
94 */
95 void process_device_buf_raw8(const camera_image_metadata_t &meta, cl_mem frame);
96
97 /**
98 * @brief Update mask based on current system state
99 *
100 * Efficiently updates the mask only when necessary, avoiding
101 * unnecessary allocations and copies.
102 *
103 * @param should_mask Whether the mask should be active
104 */
105 void update_mask_if_needed(bool should_mask);
106
107 /**
108 * @brief Check if system is ready to process images
109 *
110 * Determines whether the VIO system is ready to accept and process
111 * new image data.
112 *
113 * @return True if system is ready, false otherwise
114 */
115 bool is_system_ready() const;
116
117 /** @brief Current image height in pixels */
118 int current_height;
119
120 /** @brief Current image width in pixels */
121 int current_width;
122
123 /** @brief Current mask state to avoid unnecessary updates */
124 std::optional<bool> current_mask_state_;
125
126 /** @brief Flag indicating if mask dimensions have changed */
127 bool mask_dimensions_changed_{false};
128
129 /** @brief Flag indicating occlusion threshold has already been passed once */
130 bool occlusion_threshold_passed_{false};
131 };
132
133} // namespace voxl
134#endif // MONOCAMERAMINIMAL_H
Base class for camera implementations in 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:146