Documentation / Gemini 330 series /
C Sample Depth Stream Viewer

C Sample Depth Stream Viewer

Function description: Demonstrate using SDK to get depth data and draw display, get resolution and set, display depth images, and exit the program through ESC_KEY key

| This example is based on the C High Level API for demonstration

Firstly, you need to create a Pipeline to connect the device and open color and depth streams

pipe = ob_create_pipeline( &error );

Create a Configuration to configure the resolution, frame rate, and format of color and depth streams

ob_config* config = ob_create_config( &error );

Configure stream

//Configure Depth stream
ob_stream_profile *     depth_profile = NULL;
ob_stream_profile_list *profiles      = ob_pipeline_get_stream_profile_list(pipe, OB_SENSOR_DEPTH, &error);
//ind the corresponding Profile according to the specified format, with priority given to Y16 format
depth_profile = ob_stream_profile_list_get_video_stream_profile(profiles, 640, OB_HEIGHT_ANY, OB_FORMAT_Y16, 30, &error);
//If the Y16 format is not found and does not match the format, search for the corresponding profile to open the stream
if(error){
depth_profile = ob_stream_profile_list_get_video_stream_profile(profiles, 640, OB_HEIGHT_ANY, OB_FORMAT_ANY, 30, &error);
error = nullptr;
}
ob_config_enable_stream(config, depth_profile, &error);  // Enable configuration

Start Pipeline through Configuration

ob_pipeline_start_with_config(pipe, config, &error);

Release resources and exit the program.

//Release frameSet and reclaim memory
ob_delete_frame(frameset, &error);

//Release depth profile
ob_delete_stream_profile(depth_profile, &error);

//Release color list
ob_delete_stream_profile_list(profiles, &error);

//Release device
ob_delete_device(device, &error);

//Release pipeline
ob_delete_pipeline(pipe, &error);

Expected Output

Stay updated

Be the first to learn about our new
products and updates.