1#ifndef _CHRONOPTICS_TOF_CSF_READER_HPP_
2#define _CHRONOPTICS_TOF_CSF_READER_HPP_
4#include <chronoptics/tof/csf_reader.h>
6#include <chronoptics/tof/data.hpp>
7#include <chronoptics/tof/stream.hpp>
8#include <chronoptics/tof/calibration.hpp>
9#include <chronoptics/tof/camera_config.hpp>
11namespace chronoptics {
16class CsfReader :
public detail::Base<tof_csf_reader, tof_csf_reader_delete> {
27 this->ptr_ = tof_csf_reader_new(file_location, TOF_ERROR_HANDLER{});
34 Data new_data(
static_cast<tof_data_t
>(
nullptr));
35 auto ptr =
reinterpret_cast<tof_data_t*
>(&new_data);
36 *ptr = tof_csf_reader_read_frame(this->ptr_, TOF_ERROR_HANDLER{});
48 Data new_data(
static_cast<tof_data_t
>(
nullptr));
49 auto ptr =
reinterpret_cast<tof_data_t*
>(&new_data);
50 *ptr = tof_csf_reader_read_frame_into_pointer(this->ptr_, pointer, capacity, user_pointer_destructed_cb_handler, &callback, TOF_ERROR_HANDLER{});
63 Data new_data(
static_cast<tof_data_t
>(
nullptr));
64 auto ptr =
reinterpret_cast<tof_data_t*
>(&new_data);
65 *ptr = tof_csf_reader_read_frame_into_pointer(this->ptr_, pointer, capacity, callback, callback_user_data, TOF_ERROR_HANDLER{});
73 return tof_csf_reader_number_of_frames(this->ptr_, TOF_ERROR_HANDLER{});
82 Data new_data(
static_cast<tof_data_t
>(
nullptr));
83 auto ptr =
reinterpret_cast<tof_data_t*
>(&new_data);
84 *ptr = tof_csf_reader_get_header(this->ptr_, index, TOF_ERROR_HANDLER{});
92 Stream new_stream(
static_cast<tof_stream_t
>(
nullptr));
93 auto ptr =
reinterpret_cast<tof_stream_t*
>(&new_stream);
94 *ptr = tof_csf_reader_next_stream(this->ptr_, TOF_ERROR_HANDLER{});
102 return tof_csf_reader_next_frame_size(this->ptr_, TOF_ERROR_HANDLER{});
109 return tof_csf_reader_frame_index(this->ptr_, TOF_ERROR_HANDLER{});
116 return tof_csf_reader_go_to_frame(this->ptr_, index, TOF_ERROR_HANDLER{});
123 size_t size = tof_csf_reader_streams(this->ptr_,
nullptr, 0, TOF_ERROR_HANDLER{});
124 std::vector<Stream> vec;
126 for (
size_t i = 0; i < size; i++)
127 vec.emplace_back(
static_cast<tof_stream_t
>(
nullptr));
128 auto data =
reinterpret_cast<tof_stream_t*
>(vec.data());
129 size = tof_csf_reader_streams(this->ptr_, data, vec.size(), TOF_ERROR_HANDLER{});
138 return tof_csf_reader_stream_count(this->ptr_, *
reinterpret_cast<tof_stream_t*
>(&stream), TOF_ERROR_HANDLER{});
146 return tof_csf_reader_go_to_stream(this->ptr_, *
reinterpret_cast<tof_stream_t*
>(&stream), index, TOF_ERROR_HANDLER{});
153 Calibration new_calibration(
static_cast<tof_calibration_t
>(
nullptr));
154 auto ptr =
reinterpret_cast<tof_calibration_t*
>(&new_calibration);
155 *ptr = tof_csf_reader_get_calibration(this->ptr_, TOF_ERROR_HANDLER{});
156 return new_calibration;
163 CameraConfig new_camera_config(
static_cast<tof_camera_config_t
>(
nullptr));
164 auto ptr =
reinterpret_cast<tof_camera_config_t*
>(&new_camera_config);
165 *ptr = tof_csf_reader_get_camera_config(this->ptr_, TOF_ERROR_HANDLER{});
166 return new_camera_config;
This class contains all the calibration information.
This class allows you to view/edit the camera settings.
DEPRECATED, use CSFCamera.
std::vector< Stream > streams() const
Get the streams that are in the csf file.
size_t frame_index() const
Get the current frame position.
CsfReader(StringView file_location)
Open a csf file for reading.
CsfReader(tof_csf_reader_t ptr=nullptr)
Construct from pointer.
size_t stream_count(Stream &stream) const
Get the number of frames contained in the file of the given stream.
size_t next_frame_size() const
Get the size of the next frame.
void go_to_stream(Stream &stream, size_t index)
Go to the specified stream, the next read frame call will start from here.
Data read_frame_into_pointer(uint8_t *pointer, size_t capacity, user_pointer_destructed_fn &callback)
Read the next data frame from disk into the supplied pointer.
size_t number_of_frames() const
Get the total number of frames in the csf file.
CameraConfig get_camera_config() const
Get camera config from the csf file.
Data get_header(size_t index) const
Returns an empty Data class containing the header information for the specified frame.
Data read_frame()
Read the next data frame from disk.
Stream next_stream() const
Get the stream information of the next frame.
Calibration get_calibration() const
Get calibration from the csf file.
Data read_frame_into_pointer(uint8_t *pointer, size_t capacity, tof_user_pointer_destructed_t callback, void *callback_user_data)
Read the next data frame from disk into the supplied pointer.
void go_to_frame(size_t index)
Go to specified frame.
This is the class that contains depth or image data.
This class describes the different data streams coming from the camera.