OrbbecSDK 2.10.6
OrbbecSDK: Software-Development-Kit for Orbbec 3D Cameras
Loading...
Searching...
No Matches
Frame.h
Go to the documentation of this file.
1// Copyright (c) Orbbec Inc. All Rights Reserved.
2// Licensed under the MIT License.
3
9#pragma once
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include "ObTypes.h"
16
30OB_EXPORT ob_frame *ob_create_frame(ob_frame_type frame_type, ob_format format, uint32_t data_size, ob_error **error);
31
46OB_EXPORT ob_frame *ob_create_frame_from_other_frame(const ob_frame *other_frame, bool should_copy_data, ob_error **error);
47
60
76OB_EXPORT ob_frame *ob_create_video_frame(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes, ob_error **error);
77
95OB_EXPORT ob_frame *ob_create_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint8_t *buffer, uint32_t buffer_size,
96 ob_frame_destroy_callback *buffer_destroy_cb, void *buffer_destroy_context, ob_error **error);
97
118OB_EXPORT ob_frame *ob_create_video_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes,
119 uint8_t *buffer, uint32_t buffer_size, ob_frame_destroy_callback *buffer_destroy_cb,
120 void *buffer_destroy_context, ob_error **error);
121
133
144OB_EXPORT void ob_frame_add_ref(const ob_frame *frame, ob_error **error);
145
153OB_EXPORT void ob_delete_frame(const ob_frame *frame, ob_error **error);
154
163OB_EXPORT void ob_frame_copy_info(const ob_frame *src_frame, ob_frame *dst_frame, ob_error **error);
164
173OB_EXPORT uint64_t ob_frame_get_index(const ob_frame *frame, ob_error **error);
174
183OB_EXPORT ob_format ob_frame_get_format(const ob_frame *frame, ob_error **error);
184
193OB_EXPORT ob_frame_type ob_frame_get_type(const ob_frame *frame, ob_error **error);
194
205OB_EXPORT uint64_t ob_frame_get_timestamp_us(const ob_frame *frame, ob_error **error);
206
214OB_EXPORT void ob_frame_set_timestamp_us(ob_frame *frame, uint64_t timestamp_us, ob_error **error);
215
225OB_EXPORT uint64_t ob_frame_get_system_timestamp_us(const ob_frame *frame, ob_error **error);
226
234OB_EXPORT void ob_frame_set_system_timestamp_us(ob_frame *frame, uint64_t system_timestamp_us, ob_error **error);
235
251OB_EXPORT uint64_t ob_frame_get_global_timestamp_us(const ob_frame *frame, ob_error **error);
252
264OB_EXPORT uint8_t *ob_frame_get_data(const ob_frame *frame, ob_error **error);
265
281OB_EXPORT void ob_frame_update_data(ob_frame *frame, const uint8_t *data, uint32_t data_size, ob_error **error);
282
293OB_EXPORT uint32_t ob_frame_get_data_size(const ob_frame *frame, ob_error **error);
294
306OB_EXPORT uint8_t *ob_frame_get_metadata(const ob_frame *frame, ob_error **error);
307#define ob_video_frame_metadata ob_frame_get_metadata // for compatibility
308
317OB_EXPORT uint32_t ob_frame_get_metadata_size(const ob_frame *frame, ob_error **error);
318#define ob_video_frame_metadata_size ob_frame_get_metadata_size // for compatibility
319
334OB_EXPORT void ob_frame_update_metadata(ob_frame *frame, const uint8_t *metadata, uint32_t metadata_size, ob_error **error);
335
343OB_EXPORT bool ob_frame_has_metadata(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
344
354OB_EXPORT int64_t ob_frame_get_metadata_value(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error);
355
366
374OB_EXPORT void ob_frame_set_stream_profile(ob_frame *frame, const ob_stream_profile *stream_profile, ob_error **error);
375
386OB_EXPORT ob_sensor *ob_frame_get_sensor(const ob_frame *frame, ob_error **error);
387
398OB_EXPORT ob_device *ob_frame_get_device(const ob_frame *frame, ob_error **error);
399
408OB_EXPORT uint64_t ob_frame_get_token(const ob_frame *frame, ob_error **error);
409
417OB_EXPORT void ob_frame_set_token(ob_frame *frame, uint64_t token, ob_error **error);
418
428
437OB_EXPORT uint32_t ob_video_frame_get_width(const ob_frame *frame, ob_error **error);
438
447OB_EXPORT uint32_t ob_video_frame_get_height(const ob_frame *frame, ob_error **error);
448
461
469OB_EXPORT void ob_video_frame_set_pixel_type(ob_frame *frame, ob_pixel_type pixel_type, ob_error **error);
470
480OB_EXPORT uint8_t ob_video_frame_get_pixel_available_bit_size(const ob_frame *frame, ob_error **error);
481
490OB_EXPORT void ob_video_frame_set_pixel_available_bit_size(ob_frame *frame, uint8_t bit_size, ob_error **error);
491
501OB_EXPORT float ob_depth_frame_get_value_scale(const ob_frame *frame, ob_error **error);
502
511OB_EXPORT void ob_depth_frame_set_value_scale(ob_frame *frame, float value_scale, ob_error **error);
512
523OB_EXPORT float ob_points_frame_get_coordinate_value_scale(const ob_frame *frame, ob_error **error);
524
534
543OB_EXPORT float ob_accel_frame_get_temperature(const ob_frame *frame, ob_error **error);
544
554
563OB_EXPORT float ob_gyro_frame_get_temperature(const ob_frame *frame, ob_error **error);
564
575OB_EXPORT uint32_t ob_frameset_get_count(const ob_frame *frameset, ob_error **error);
576
587OB_EXPORT ob_frame *ob_frameset_get_depth_frame(const ob_frame *frameset, ob_error **error);
588
599OB_EXPORT ob_frame *ob_frameset_get_color_frame(const ob_frame *frameset, ob_error **error);
600
611OB_EXPORT ob_frame *ob_frameset_get_ir_frame(const ob_frame *frameset, ob_error **error);
612
623OB_EXPORT ob_frame *ob_frameset_get_points_frame(const ob_frame *frameset, ob_error **error);
624
636OB_EXPORT ob_frame *ob_frameset_get_frame(const ob_frame *frameset, ob_frame_type frame_type, ob_error **error);
637
647OB_EXPORT ob_frame *ob_frameset_get_frame_by_index(const ob_frame *frameset, uint32_t index, ob_error **error);
648
660OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame, ob_error **error);
661
670OB_EXPORT uint32_t ob_point_cloud_frame_get_width(const ob_frame *frame, ob_error **error);
671
680OB_EXPORT uint32_t ob_point_cloud_frame_get_height(const ob_frame *frame, ob_error **error);
681
682// The following interfaces are deprecated and are retained here for compatibility purposes.
683#define ob_frame_index ob_frame_get_index
684#define ob_frame_format ob_frame_get_format
685#define ob_frame_time_stamp_us ob_frame_get_timestamp_us
686#define ob_frame_set_device_time_stamp_us ob_frame_set_timestamp_us
687#define ob_frame_system_time_stamp_us ob_frame_get_system_timestamp_us
688#define ob_frame_global_time_stamp_us ob_frame_get_global_timestamp_us
689#define ob_frame_data ob_frame_get_data
690#define ob_frame_data_size ob_frame_get_data_size
691#define ob_frame_metadata ob_frame_get_metadata
692#define ob_frame_metadata_size ob_frame_get_metadata_size
693#define ob_video_frame_width ob_video_frame_get_width
694#define ob_video_frame_height ob_video_frame_get_height
695#define ob_video_frame_pixel_available_bit_size ob_video_frame_get_pixel_available_bit_size
696#define ob_points_frame_get_position_value_scale ob_points_frame_get_coordinate_value_scale
697#define ob_frameset_frame_count ob_frameset_get_count
698#define ob_frameset_depth_frame ob_frameset_get_depth_frame
699#define ob_frameset_color_frame ob_frameset_get_color_frame
700#define ob_frameset_ir_frame ob_frameset_get_ir_frame
701#define ob_frameset_points_frame ob_frameset_get_points_frame
702#define ob_accel_frame_value ob_accel_frame_get_value
703#define ob_accel_frame_temperature ob_accel_frame_get_temperature
704#define ob_gyro_frame_value ob_gyro_frame_get_value
705#define ob_gyro_frame_temperature ob_gyro_frame_get_temperature
706#define ob_frameset_get_frame_count ob_frameset_get_count
707
708#define ob_frame_time_stamp(frame, err) (ob_frame_get_timestamp_us(frame, err) / 1000)
709#define ob_frame_system_time_stamp(frame, err) (ob_frame_get_system_timestamp_us(frame, err))
710#define ob_frame_set_system_time_stamp(frame, system_timestamp, err) (ob_frame_set_system_timestamp_us(frame, system_timestamp * 1000, err))
711#define ob_frame_set_device_time_stamp(frame, device_timestamp, err) (ob_frame_set_timestamp_us(frame, device_timestamp * 1000, err))
712
713#ifdef __cplusplus
714}
715#endif
OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame, ob_error **error)
Push a frame to the frameset.
OB_EXPORT ob_frame * ob_frameset_get_color_frame(const ob_frame *frameset, ob_error **error)
Get the color frame from the frameset.
OB_EXPORT ob_device_info * ob_frame_get_device_info(const ob_frame *frame, ob_error **error)
Get the device information attached to the frame.
OB_EXPORT ob_frame * ob_frameset_get_ir_frame(const ob_frame *frameset, ob_error **error)
Get the infrared frame from the frameset.
OB_EXPORT ob_frame * ob_create_video_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes, uint8_t *buffer, uint32_t buffer_size, ob_frame_destroy_callback *buffer_destroy_cb, void *buffer_destroy_context, ob_error **error)
Create a video frame object based on an externally created buffer.
OB_EXPORT void ob_frame_copy_info(const ob_frame *src_frame, ob_frame *dst_frame, ob_error **error)
Copy the information of the source frame object to the destination frame object.
OB_EXPORT void ob_frame_update_data(ob_frame *frame, const uint8_t *data, uint32_t data_size, ob_error **error)
Update the data of a frame.
OB_EXPORT void ob_video_frame_set_pixel_type(ob_frame *frame, ob_pixel_type pixel_type, ob_error **error)
Set video frame pixel format.
OB_EXPORT uint8_t * ob_frame_get_data(const ob_frame *frame, ob_error **error)
Get the data buffer of a frame.
OB_EXPORT ob_frame * ob_create_frame_from_buffer(ob_frame_type frame_type, ob_format format, uint8_t *buffer, uint32_t buffer_size, ob_frame_destroy_callback *buffer_destroy_cb, void *buffer_destroy_context, ob_error **error)
Create a frame object based on an externally created buffer.
OB_EXPORT ob_frame * ob_create_frame_from_stream_profile(const ob_stream_profile *stream_profile, ob_error **error)
Create a frame object according to the specified stream profile.
OB_EXPORT void ob_frame_set_system_timestamp_us(ob_frame *frame, uint64_t system_timestamp_us, ob_error **error)
Set the system timestamp of the frame in microseconds.
OB_EXPORT ob_frame * ob_create_frame_from_other_frame(const ob_frame *other_frame, bool should_copy_data, ob_error **error)
Create (clone) a frame object based on the specified other frame object.
OB_EXPORT uint64_t ob_frame_get_timestamp_us(const ob_frame *frame, ob_error **error)
Get the frame timestamp (also known as device timestamp, hardware timestamp) of the frame in microsec...
OB_EXPORT ob_frame * ob_create_video_frame(ob_frame_type frame_type, ob_format format, uint32_t width, uint32_t height, uint32_t stride_bytes, ob_error **error)
Create an video frame object based on the specified parameters.
OB_EXPORT ob_frame_type ob_frame_get_type(const ob_frame *frame, ob_error **error)
Get the frame type.
OB_EXPORT ob_frame * ob_frameset_get_frame(const ob_frame *frameset, ob_frame_type frame_type, ob_error **error)
Get a frame of a specific type from the frameset.
OB_EXPORT ob_frame * ob_create_frameset(ob_error **error)
Create an empty frameset object.
OB_EXPORT ob_format ob_frame_get_format(const ob_frame *frame, ob_error **error)
Get the frame format.
OB_EXPORT ob_accel_value ob_accel_frame_get_value(const ob_frame *frame, ob_error **error)
Get accelerometer frame data.
OB_EXPORT uint32_t ob_video_frame_get_width(const ob_frame *frame, ob_error **error)
Get video frame width.
OB_EXPORT uint8_t ob_video_frame_get_pixel_available_bit_size(const ob_frame *frame, ob_error **error)
Get the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effectiv...
OB_EXPORT ob_frame * ob_frameset_get_points_frame(const ob_frame *frameset, ob_error **error)
Get point cloud frame from the frameset.
OB_EXPORT float ob_depth_frame_get_value_scale(const ob_frame *frame, ob_error **error)
Get the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale...
OB_EXPORT ob_stream_profile * ob_frame_get_stream_profile(const ob_frame *frame, ob_error **error)
Get the stream profile of the frame.
OB_EXPORT float ob_points_frame_get_coordinate_value_scale(const ob_frame *frame, ob_error **error)
Get the point coordinate value scale of the points frame. The point position value of the points fram...
OB_EXPORT float ob_accel_frame_get_temperature(const ob_frame *frame, ob_error **error)
Get the temperature when acquiring the accelerometer frame.
OB_EXPORT ob_frame * ob_frameset_get_frame_by_index(const ob_frame *frameset, uint32_t index, ob_error **error)
Get a frame at a specific index from the FrameSet.
OB_EXPORT bool ob_frame_has_metadata(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error)
check if the frame contains the specified metadata
OB_EXPORT void ob_depth_frame_set_value_scale(ob_frame *frame, float value_scale, ob_error **error)
Set the value scale of the depth frame. The pixel value of the depth frame is multiplied by the scale...
OB_EXPORT int64_t ob_frame_get_metadata_value(const ob_frame *frame, ob_frame_metadata_type type, ob_error **error)
Get the metadata value of the frame.
OB_EXPORT uint32_t ob_point_cloud_frame_get_width(const ob_frame *frame, ob_error **error)
Get point cloud frame width.
OB_EXPORT ob_gyro_value ob_gyro_frame_get_value(const ob_frame *frame, ob_error **error)
Get gyroscope frame data.
OB_EXPORT uint64_t ob_frame_get_global_timestamp_us(const ob_frame *frame, ob_error **error)
Get the global timestamp of the frame in microseconds.
OB_EXPORT uint64_t ob_frame_get_token(const ob_frame *frame, ob_error **error)
Get the auth token carried by the frame.
OB_EXPORT uint32_t ob_frame_get_metadata_size(const ob_frame *frame, ob_error **error)
Get the metadata size of the frame.
OB_EXPORT void ob_frame_set_timestamp_us(ob_frame *frame, uint64_t timestamp_us, ob_error **error)
Set the frame timestamp (also known as the device timestamp, hardware timestamp) of a frame object.
OB_EXPORT uint32_t ob_frame_get_data_size(const ob_frame *frame, ob_error **error)
Get the frame data size.
OB_EXPORT void ob_frame_set_token(ob_frame *frame, uint64_t token, ob_error **error)
Set the auth token carried by the frame.
OB_EXPORT ob_device * ob_frame_get_device(const ob_frame *frame, ob_error **error)
Get the device of the frame.
OB_EXPORT uint64_t ob_frame_get_system_timestamp_us(const ob_frame *frame, ob_error **error)
Get the system timestamp of the frame in microseconds.
OB_EXPORT void ob_frame_update_metadata(ob_frame *frame, const uint8_t *metadata, uint32_t metadata_size, ob_error **error)
Update the metadata of the frame.
OB_EXPORT float ob_gyro_frame_get_temperature(const ob_frame *frame, ob_error **error)
Get the temperature when acquiring the gyroscope frame.
OB_EXPORT uint64_t ob_frame_get_index(const ob_frame *frame, ob_error **error)
Get the frame index.
OB_EXPORT void ob_frame_add_ref(const ob_frame *frame, ob_error **error)
Increase the reference count of a frame object.
OB_EXPORT ob_frame * ob_frameset_get_depth_frame(const ob_frame *frameset, ob_error **error)
Get the depth frame from the frameset.
OB_EXPORT void ob_video_frame_set_pixel_available_bit_size(ob_frame *frame, uint8_t bit_size, ob_error **error)
Set the effective number of pixels (such as Y16 format frame, but only the lower 10 bits are effectiv...
OB_EXPORT uint32_t ob_point_cloud_frame_get_height(const ob_frame *frame, ob_error **error)
Get point cloud frame height.
OB_EXPORT ob_pixel_type ob_video_frame_get_pixel_type(const ob_frame *frame, ob_error **error)
Get video frame pixel format.
OB_EXPORT void ob_delete_frame(const ob_frame *frame, ob_error **error)
Delete a frame object.
OB_EXPORT ob_sensor * ob_frame_get_sensor(const ob_frame *frame, ob_error **error)
Get the sensor of the frame.
OB_EXPORT ob_frame * ob_create_frame(ob_frame_type frame_type, ob_format format, uint32_t data_size, ob_error **error)
Crate a frame object based on the specified parameters.
OB_EXPORT uint8_t * ob_frame_get_metadata(const ob_frame *frame, ob_error **error)
Get the metadata of the frame.
OB_EXPORT void ob_frame_set_stream_profile(ob_frame *frame, const ob_stream_profile *stream_profile, ob_error **error)
Set (override) the stream profile of the frame.
OB_EXPORT uint32_t ob_frameset_get_count(const ob_frame *frameset, ob_error **error)
Get the number of frames contained in the frameset.
OB_EXPORT uint32_t ob_video_frame_get_height(const ob_frame *frame, ob_error **error)
Get video frame height.
Provide structs commonly used in the SDK, enumerating constant definitions.
struct ob_sensor_t ob_sensor
Definition ObTypes.h:29
struct ob_frame_t ob_frame
Definition ObTypes.h:33
enum OBFormat ob_format
struct ob_device_info_t ob_device_info
Definition ObTypes.h:24
struct ob_stream_profile_t ob_stream_profile
Definition ObTypes.h:31
struct ob_device_t ob_device
Definition ObTypes.h:23
struct OBAccelValue ob_accel_value
struct OBAccelValue ob_gyro_value
void ob_frame_destroy_callback(uint8_t *buffer, void *user_data)
Customize the delete callback.
Definition ObTypes.h:2186
enum OBFrameType ob_frame_type
ob_frame_metadata_type
Frame metadata types.
Definition ObTypes.h:1796
enum OBPixelType ob_pixel_type
The error class exposed by the SDK, users can get detailed error information according to the error.
Definition ObTypes.h:162