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