19 #define STREAM RS2_STREAM_DEPTH // rs2_stream is a types of data provided by RealSense device // 20 #define FORMAT RS2_FORMAT_Z16 // rs2_format identifies how binary data is encoded within a frame // 21 #define WIDTH 640 // Defines the number of columns for each frame or zero for auto resolve// 22 #define HEIGHT 0 // Defines the number of lines for each frame or zero for auto resolve // 23 #define FPS 30 // Defines the rate of frames per second // 24 #define STREAM_INDEX 0 // Defines the stream index, used for multiple streams of the same type // 25 #define HEIGHT_RATIO 20 // Defines the height ratio between the original frame to the new frame // 26 #define WIDTH_RATIO 10 // Defines the width ratio between the original frame to the new frame // 40 int is_depth_sensor_found = 0;
42 for (i = 0; i < num_of_sensors; ++
i)
51 if (1 == is_depth_sensor_found)
62 if (0 == is_depth_sensor_found)
64 printf(
"Depth sensor not found!\n");
88 printf(
"There are %d connected RealSense devices.\n", dev_count);
121 printf(
"The connected device doesn't support depth streaming!\n");
128 printf(
"Failed to create stream profile list!\n");
135 printf(
"Failed to create stream profile!\n");
143 printf(
"Failed to get stream profile data!\n");
151 printf(
"Failed to get video stream resolution data!\n");
156 int display_size = (rows + 1) * (row_length + 1);
157 int buffer_size = display_size *
sizeof(char);
159 char*
buffer = calloc(display_size,
sizeof(
char));
175 for (i = 0; i < num_of_frames; ++
i)
196 int*
coverage = calloc(row_length,
sizeof(
int));
200 for (x = 0; x <
width; ++
x)
204 int depth = *depth_frame_data++;
205 if (depth > 0 && depth < one_meter)
206 ++coverage[coverage_index];
211 for (i = 0; i < (row_length); ++
i)
213 static const char*
pixels =
" .:nhBXWW";
215 *out++ = pixels[pixel_index];
222 printf(
"\n%s", buffer);
int rs2_get_sensors_count(const rs2_sensor_list *info_list, rs2_error **error)
void rs2_config_enable_stream(rs2_config *config, rs2_stream stream, int index, int width, int height, rs2_format format, int framerate, rs2_error **error)
void print_device_info(rs2_device *dev)
float rs2_get_option(const rs2_options *options, rs2_option option, rs2_error **error)
Exposes RealSense processing-block functionality for C compilers.
rs2_device_list * rs2_query_devices(const rs2_context *context, rs2_error **error)
float get_depth_unit_value(const rs2_device *const dev)
int rs2_is_frame_extendable_to(const rs2_frame *frame, rs2_extension extension_type, rs2_error **error)
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
rs2_sensor * rs2_create_sensor(const rs2_sensor_list *list, int index, rs2_error **error)
void rs2_delete_device(rs2_device *device)
rs2_context * rs2_create_context(int api_version, rs2_error **error)
Creates RealSense context that is required for the rest of the API.
rs2_config * rs2_create_config(rs2_error **error)
void rs2_delete_context(rs2_context *context)
Frees the relevant context object.
rs2_pipeline * rs2_create_pipeline(rs2_context *ctx, rs2_error **error)
rs2_device * rs2_create_device(const rs2_device_list *info_list, int index, rs2_error **error)
GLint GLint GLsizei GLsizei GLsizei depth
void check_error(rs2_error *e)
Exposes librealsense functionality for C compilers.
rs2_stream_profile_list * rs2_pipeline_profile_get_streams(rs2_pipeline_profile *profile, rs2_error **error)
rs2_frame * rs2_pipeline_wait_for_frames(rs2_pipeline *pipe, unsigned int timeout_ms, rs2_error **error)
void rs2_get_stream_profile_data(const rs2_stream_profile *mode, rs2_stream *stream, rs2_format *format, int *index, int *unique_id, int *framerate, rs2_error **error)
Exposes RealSense frame functionality for C compilers.
int rs2_embedded_frames_count(rs2_frame *composite, rs2_error **error)
void rs2_delete_sensor(rs2_sensor *sensor)
void rs2_delete_stream_profile(rs2_stream_profile *mode)
GLint GLsizei GLsizei height
GLint GLint GLsizei GLint GLenum format
const rs2_stream_profile * rs2_get_stream_profile(const rs2_stream_profile_list *list, int index, rs2_error **error)
rs2_sensor_list * rs2_query_sensors(const rs2_device *device, rs2_error **error)
rs2_format
A stream's format identifies how binary data is encoded within a frame.
#define RS2_DEFAULT_TIMEOUT
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
Exposes sensor options functionality for C compilers.
rs2_stream
Streams are different types of data provided by RealSense devices.
static const textual_icon exit
rs2_pipeline_profile * rs2_pipeline_start_with_config(rs2_pipeline *pipe, rs2_config *config, rs2_error **error)
int rs2_is_sensor_extendable_to(const rs2_sensor *sensor, rs2_extension extension, rs2_error **error)
void rs2_delete_stream_profiles_list(rs2_stream_profile_list *list)
void rs2_pipeline_stop(rs2_pipeline *pipe, rs2_error **error)
void rs2_delete_config(rs2_config *config)
void rs2_delete_sensor_list(rs2_sensor_list *info_list)
void rs2_release_frame(rs2_frame *frame)
rs2_frame * rs2_extract_frame(rs2_frame *composite, int index, rs2_error **error)
void rs2_delete_device_list(rs2_device_list *info_list)
void rs2_delete_pipeline_profile(rs2_pipeline_profile *profile)
int rs2_get_device_count(const rs2_device_list *info_list, rs2_error **error)
void rs2_delete_pipeline(rs2_pipeline *pipe)
struct rs2_frame rs2_frame
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)