ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
AzureKinectSensor.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <memory>
11 
12 #include "io/sensor/RGBDSensor.h"
14 
15 struct _k4a_capture_t; // typedef _k4a_capture_t* k4a_capture_t;
16 struct _k4a_device_t; // typedef _k4a_device_t* k4a_device_t;
17 struct _k4a_transformation_t; // typedef _k4a_transformation_t*
18  // k4a_transformation_t;
19 
20 namespace cloudViewer {
21 namespace geometry {
22 class RGBDImage;
23 class Image;
24 } // namespace geometry
25 
26 namespace io {
27 
28 // Avoid including AzureKinectRecorder.h
29 class AzureKinectRecorder;
30 
34 class AzureKinectSensor : public RGBDSensor {
35 public:
37  AzureKinectSensor(const AzureKinectSensorConfig& sensor_config);
39 
40  bool Connect(size_t sensor_index) override;
41  void Disconnect();
42  std::shared_ptr<geometry::RGBDImage> CaptureFrame(
43  bool enable_align_depth_to_color) const override;
44 
45  static bool PrintFirmware(_k4a_device_t* device);
47  static bool ListDevices();
48  static std::shared_ptr<geometry::RGBDImage> DecompressCapture(
49  _k4a_capture_t* capture, _k4a_transformation_t* transformation);
50 
51 protected:
52  _k4a_capture_t* CaptureRawFrame() const;
53 
55  _k4a_transformation_t* transform_depth_to_color_;
56  _k4a_device_t* device_;
57  int timeout_;
58 
59  friend class AzureKinectRecorder;
60 };
61 
62 } // namespace io
63 } // namespace cloudViewer
cloudViewer::io::AzureKinectSensor::CaptureRawFrame
_k4a_capture_t * CaptureRawFrame() const
Definition: AzureKinectSensor.cpp:115
cloudViewer::io::k4a_plugin::k4a_device_open
k4a_result_t k4a_device_open(EXTRACT_TYPES_PARAMS(COUNT_ARGS(uint32_t, index, k4a_device_t *, device_handle), uint32_t, index, k4a_device_t *, device_handle))
Definition: K4aPlugin.cpp:364
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::io::k4a_plugin::k4a_image_get_height_pixels
int k4a_image_get_height_pixels(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_image_t, image_handle), k4a_image_t, image_handle))
Definition: K4aPlugin.cpp:518
cloudViewer::io::k4a_plugin::k4a_image_get_size
size_t k4a_image_get_size(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_image_t, image_handle), k4a_image_t, image_handle))
Definition: K4aPlugin.cpp:500
rgb
normal_z rgb
Definition: my_point_types.h:168
cloudViewer::io::k4a_plugin::k4a_capture_get_depth_image
k4a_image_t k4a_capture_get_depth_image(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_capture_t, capture_handle), k4a_capture_t, capture_handle))
Definition: K4aPlugin.cpp:414
NULL
#define NULL
Definition: UVUnwrapping.cpp:40
cloudViewer::io::AzureKinectSensor::CaptureFrame
std::shared_ptr< geometry::RGBDImage > CaptureFrame(bool enable_align_depth_to_color) const override
Definition: AzureKinectSensor.cpp:132
cloudViewer::io::AzureKinectRecorder
Definition: AzureKinectRecorder.h:32
cloudViewer::io::AzureKinectSensor::DecompressCapture
static std::shared_ptr< geometry::RGBDImage > DecompressCapture(_k4a_capture_t *capture, _k4a_transformation_t *transformation)
Definition: AzureKinectSensor.cpp:231
cloudViewer::io::AzureKinectSensor::timeout_
int timeout_
Definition: AzureKinectSensor.h:57
cloudViewer::io::k4a_plugin::k4a_device_get_installed_count
uint32_t k4a_device_get_installed_count(EXTRACT_TYPES_PARAMS(COUNT_ARGS(),))
Definition: K4aPlugin.cpp:346
result
core::Tensor result
Definition: VtkUtils.cpp:76
width
int width
Definition: FileIOFactory.cpp:142
Parallel.h
cloudViewer::io::AzureKinectSensor::sensor_config_
AzureKinectSensorConfig sensor_config_
Definition: AzureKinectSensor.h:54
height
int height
Definition: FileIOFactory.cpp:143
cloudViewer::io::AzureKinectSensor
Definition: AzureKinectSensor.h:34
AzureKinectSensor.h
cloudViewer::io::k4a_plugin::k4a_device_start_cameras
k4a_result_t k4a_device_start_cameras(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle, k4a_device_configuration_t *, config), k4a_device_t, device_handle, k4a_device_configuration_t *, config))
Definition: K4aPlugin.cpp:594
AzureKinectSensorConfig.h
cloudViewer::io::k4a_plugin::k4a_device_get_calibration
k4a_result_t k4a_device_get_calibration(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle, const k4a_depth_mode_t, depth_mode, const k4a_color_resolution_t, color_resolution, k4a_calibration_t *, calibration), k4a_device_t, device_handle, const k4a_depth_mode_t, depth_mode, const k4a_color_resolution_t, color_resolution, k4a_calibration_t *, calibration))
Definition: K4aPlugin.cpp:693
cloudViewer::io::k4a_plugin::k4a_device_set_color_control
k4a_result_t k4a_device_set_color_control(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle, k4a_color_control_command_t, command, k4a_color_control_mode_t, mode, int32_t, value), k4a_device_t, device_handle, k4a_color_control_command_t, command, k4a_color_control_mode_t, mode, int32_t, value))
Definition: K4aPlugin.cpp:671
cloudViewer::geometry::Image::height_
int height_
Height of the image.
Definition: Image.h:221
LogDebug
#define LogDebug(...)
Definition: Logging.h:90
cloudViewer::io::AzureKinectSensor::~AzureKinectSensor
~AzureKinectSensor()
Definition: AzureKinectSensor.cpp:27
K4aPlugin.h
cloudViewer::io::k4a_plugin::k4a_image_create_from_buffer
k4a_result_t k4a_image_create_from_buffer(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_image_format_t, format, int, width_pixels, int, height_pixels, int, stride_bytes, uint8_t *, buffer, size_t, buffer_size, k4a_memory_destroy_cb_t *, buffer_release_cb, void *, buffer_release_cb_context, k4a_image_t *, image_handle), k4a_image_format_t, format, int, width_pixels, int, height_pixels, int, stride_bytes, uint8_t *, buffer, size_t, buffer_size, k4a_memory_destroy_cb_t *, buffer_release_cb, void *, buffer_release_cb_context, k4a_image_t *, image_handle))
Definition: K4aPlugin.cpp:494
cloudViewer::io::RGBDSensor
Definition: RGBDSensor.h:22
cloudViewer::io::k4a_plugin::k4a_capture_release
void k4a_capture_release(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_capture_t, capture_handle), k4a_capture_t, capture_handle))
Definition: K4aPlugin.cpp:396
cloudViewer::io::k4a_plugin::k4a_capture_get_color_image
k4a_image_t k4a_capture_get_color_image(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_capture_t, capture_handle), k4a_capture_t, capture_handle))
Definition: K4aPlugin.cpp:408
cloudViewer::geometry::Image::num_of_channels_
int num_of_channels_
Number of chanels in the image.
Definition: Image.h:223
cloudViewer::io::k4a_plugin::k4a_device_get_capture
k4a_wait_result_t k4a_device_get_capture(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle, k4a_capture_t *, capture_handle, int32_t, timeout_in_ms), k4a_device_t, device_handle, k4a_capture_t *, capture_handle, int32_t, timeout_in_ms))
Definition: K4aPlugin.cpp:377
cloudViewer::io::k4a_plugin::k4a_device_stop_cameras
void k4a_device_stop_cameras(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle), k4a_device_t, device_handle))
Definition: K4aPlugin.cpp:600
cloudViewer::geometry::Image::width_
int width_
Width of the image.
Definition: Image.h:219
cloudViewer::io::k4a_plugin::k4a_image_get_buffer
uint8_t * k4a_image_get_buffer(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_image_t, image_handle), k4a_image_t, image_handle))
Definition: K4aPlugin.cpp:497
LogError
#define LogError(...)
Definition: Logging.h:60
cloudViewer::geometry::Image::PointerAt
T * PointerAt(int u, int v) const
Function to access the raw data of a single-channel Image.
Definition: Image.cpp:77
cloudViewer::io::k4a_plugin::k4a_image_release
void k4a_image_release(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_image_t, image_handle), k4a_image_t, image_handle))
Definition: K4aPlugin.cpp:586
cloudViewer::io::AzureKinectSensor::transform_depth_to_color_
_k4a_transformation_t * transform_depth_to_color_
Definition: AzureKinectSensor.h:55
cloudViewer::io::AzureKinectSensor::PrintFirmware
static bool PrintFirmware(_k4a_device_t *device)
Definition: AzureKinectSensor.cpp:177
cloudViewer::geometry::Image::bytes_per_channel_
int bytes_per_channel_
Number of bytes per channel.
Definition: Image.h:225
LogInfo
#define LogInfo(...)
Definition: Logging.h:81
cloudViewer::io::AzureKinectSensor::Connect
bool Connect(size_t sensor_index) override
Definition: AzureKinectSensor.cpp:29
cloudViewer::io::ConvertBGRAToRGB
void ConvertBGRAToRGB(geometry::Image &bgra, geometry::Image &rgb)
Definition: AzureKinectSensor.cpp:142
cloudViewer::io::AzureKinectSensor::ListDevices
static bool ListDevices()
List available Azure Kinect devices.
Definition: AzureKinectSensor.cpp:210
cloudViewer::io::k4a_plugin::k4a_transformation_depth_image_to_color_camera
k4a_result_t k4a_transformation_depth_image_to_color_camera(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_transformation_t, transformation_handle, const k4a_image_t, depth_image, k4a_image_t, transformed_depth_image), k4a_transformation_t, transformation_handle, const k4a_image_t, depth_image, k4a_image_t, transformed_depth_image))
Definition: K4aPlugin.cpp:805
LogWarning
#define LogWarning(...)
Definition: Logging.h:72
cloudViewer::io::k4a_plugin::k4a_transformation_create
k4a_transformation_t k4a_transformation_create(EXTRACT_TYPES_PARAMS(COUNT_ARGS(const k4a_calibration_t *, calibration), const k4a_calibration_t *, calibration))
Definition: K4aPlugin.cpp:789
cloudViewer::io::k4a_plugin::k4a_device_close
void k4a_device_close(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle), k4a_device_t, device_handle))
Definition: K4aPlugin.cpp:367
cloudViewer::io::k4a_plugin::k4a_device_get_serialnum
k4a_buffer_result_t k4a_device_get_serialnum(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle, char *, serial_number, size_t *, serial_number_size), k4a_device_t, device_handle, char *, serial_number, size_t *, serial_number_size))
Definition: K4aPlugin.cpp:619
cloudViewer::io::AzureKinectSensorConfig::ConvertToNativeConfig
_k4a_device_configuration_t ConvertToNativeConfig() const
Definition: AzureKinectSensorConfig.cpp:282
cloudViewer::io::k4a_plugin::k4a_device_get_version
k4a_result_t k4a_device_get_version(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_device_t, device_handle, k4a_hardware_version_t *, version), k4a_device_t, device_handle, k4a_hardware_version_t *, version))
Definition: K4aPlugin.cpp:627
cloudViewer::io::AzureKinectSensor::Disconnect
void Disconnect()
Definition: AzureKinectSensor.cpp:110
cloudViewer::io::AzureKinectSensorConfig
Definition: AzureKinectSensorConfig.h:27
cloudViewer::io::AzureKinectSensor::device_
_k4a_device_t * device_
Definition: AzureKinectSensor.h:56
cloudViewer::geometry::Image
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition: Image.h:33
cloudViewer::io::k4a_plugin::k4a_image_get_format
k4a_image_format_t k4a_image_get_format(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_image_t, image_handle), k4a_image_t, image_handle))
Definition: K4aPlugin.cpp:506
cloudViewer::io::AzureKinectSensor::AzureKinectSensor
AzureKinectSensor(const AzureKinectSensorConfig &sensor_config)
Default Constructor.
Definition: AzureKinectSensor.cpp:23
cloudViewer::io::k4a_plugin::k4a_image_get_width_pixels
int k4a_image_get_width_pixels(EXTRACT_TYPES_PARAMS(COUNT_ARGS(k4a_image_t, image_handle), k4a_image_t, image_handle))
Definition: K4aPlugin.cpp:512