VOXL OpenVINS Server 1.0
Visual Inertial Odometry Server for VOXL Platform
Loading...
Searching...
No Matches
StereoCameraMinimal.h
Go to the documentation of this file.
1/**
2 * @file StereoCameraMinimal.h
3 * @brief Stereo camera implementation for VOXL OpenVINS
4 * @author Zauberflote
5 * @date 2025
6 * @version 1.0
7 *
8 * This header defines the StereoCamera class, which specializes the CameraBase
9 * for stereo camera configurations. It handles single camera image processing
10 * and integration with the VIO system.
11 */
12
13#ifndef STEREOCAMERAMINIMAL_H
14#define STEREOCAMERAMINIMAL_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
24namespace voxl
25{
26
27 /**
28 * @class StereoCamera
29 * @brief Handles stereo camera input
30 *
31 * This class specializes CameraBase for stereo camera configurations.
32 * It processes images from a single camera and feeds them to the VIO system.
33 *
34 * The StereoCamera 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 stereo setups
44 * - Integrates with the camera queue fusion system
45 * - Handles various image formats and buffer types
46 */
47 class StereoCamera : public CameraBase
48 {
49 public:
50 /**
51 * @brief Constructor
52 * @param camera_info Camera configuration information
53 */
54 explicit StereoCamera(const cam_info &camera_info);
55
56 /**
57 * @brief Destructor
58 */
59 ~StereoCamera() override = default;
60
61 protected:
62 /**
63 * @brief Process incoming image data
64 *
65 * Overrides the base class method to handle stereo 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 Update masks based on current system state
88 *
89 * Efficiently updates both masks only when necessary, avoiding
90 * unnecessary allocations and copies. Each camera can have
91 * independent masking logic.
92 *
93 * @param should_mask_left Whether the left camera mask should be active
94 * @param should_mask_right Whether the right camera mask should be active
95 */
96 void update_masks_if_needed(bool should_mask_left, bool should_mask_right);
97
98 /**
99 * @brief Check if system is in reset state
100 *
101 * Determines whether the VIO system is currently in a reset state,
102 * which affects how image processing should be handled.
103 *
104 * @return True if system is resetting, false otherwise
105 */
106 bool is_system_resetting() const;
107
108 /**
109 * @brief Check if system is ready to process images
110 *
111 * Determines whether the VIO system is ready to accept and process
112 * new image data.
113 *
114 * @return True if system is ready, false otherwise
115 */
116 bool is_system_ready() const;
117
118 /** @brief Current image height in pixels */
119 int current_height;
120
121 /** @brief Current image width in pixels */
122 int current_width;
123
124 /** @brief Use mask for the second camera */
125 cv::Mat use_mask2_;
126
127 /** @brief Current mask state for left camera to avoid unnecessary updates */
128 std::optional<bool> current_mask_state_left_;
129
130 /** @brief Current mask state for right camera to avoid unnecessary updates */
131 std::optional<bool> current_mask_state_right_;
132
133 /** @brief Flag indicating if mask dimensions have changed */
134 bool mask_dimensions_changed_{false};
135 };
136
137} // namespace voxl
138#endif // STEREOCAMERAMINIMAL_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 stereo camera input.
~StereoCamera() 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