#include <astra/capi/astra.h>
#include <stdio.h>
#include <key_handler.h>
{
int16_t* depthData;
uint32_t depthLength;
astra_depthframe_get_data_ptr(depthFrame, &depthData, &depthLength);
astra_depthframe_get_metadata(depthFrame, &metadata);
int width = metadata.
width;
int height = metadata.
height;
size_t index = ((width * (height / 2)) + (width / 2));
short middle = depthData[index];
astra_frame_index_t frameIndex;
astra_depthframe_get_frameindex(depthFrame, &frameIndex);
printf("depth frameIndex: %d value: %d \n", frameIndex, middle);
}
void frame_ready(void* clientTag, astra_reader_t reader, astra_reader_frame_t frame)
{
astra_frame_get_depthframe(frame, &depthFrame);
print_depth(depthFrame);
}
int main(int argc, char* argv[])
{
set_key_handler();
astra_initialize();
astra_streamsetconnection_t sensor;
astra_streamset_open("device/default", &sensor);
astra_reader_t reader;
astra_reader_create(sensor, &reader);
astra_reader_get_depthstream(reader, &depthStream);
astra_stream_start(depthStream);
astra_reader_register_frame_ready_callback(reader, &frame_ready, NULL, &callbackId);
do
{
astra_update();
} while (shouldContinue);
astra_reader_unregister_frame_ready_callback(&callbackId);
astra_reader_destroy(&reader);
astra_streamset_close(&sensor);
astra_terminate();
}
Definition: stream_types.h:37
Definition: astra_plugin.h:29
Definition: astra_plugin.h:24