You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All definitions of structures and declarations of functions in SmartToF SDK are located in dmcam.h under lib\include. For example for Windows, the definitions and declarations are under SDK/windows/dmcam/lib/include. There are detailed explanation of the functions and their parameters in it.
3.1 Simplified data acquisition sample
/*Initialization*/dmcam_init(NULL);
...
/*Open device*/dev=dmcam_dev_open(NULL);//Open the first device/*Setting acquisition buffer*/dmcam_cap_cfg_tcap_cfg= {
.cache_frames_cnt=FRAME_BUF_FCNT, /* FRAME_BUF_FCNT frames can be cached in frame buffer*/
.on_error=NULL, /* No error callback */
.on_frame_ready=NULL, /* No frame ready callback*/
.en_save_replay= false, /* false save raw data stream to replay file */
.en_save_dist_u16= false, /* disable save dist stream into replay file */
.en_save_gray_u16= false, /* disable save gray stream into replay file*/
.fname_replay=NULL, /* replay filename */
};
dmcam_cap_config_set(dev,&cap_cfg);
...
/*Start acquisition*/dmcam_cap_start(dev);//Start acquisition/*Obtaining data*/fr_cnt=dmcam_cap_get_frames(dev,20,fbuf,FRAME_SIZE*20,&fbuf_info);//Acquire 20 frames/*Acquire depth data*/dmcam_frame_get_dist_u16(dev,dist,dist_len,fbuf,fbuf_info.frame_info.frame_size, &fbuf_info.frame_info);//Transform one frame to depth data/*Acquire gray data*/dmcam_frame_get_gray_u16(dev,gray,gray_len,fbuf,fbuf_info.frame_info.frame_size, &fbuf_info.frame_info);;//Transform one frame to gray data/*Acquire pointcloud data*/dmcam_frame_get_pcl(dev,pcl,pcl_len,dist,dist_len,img_w,img_h,NULL);//Transform the depth data to pointcloud data/*Stop acquisition*/dmcam_cap_stop(dev);
...
dmcam_dev_close(dev);
dmcam_uninit();
3.2 Introduction on main APIs
3.2.1 Initialize module
dmcam_init(constchar*log_fname); //Initialization
Parameter
Description
log_fname
File name of log. If it is NULL, the default file name is dmcam_YYYYMMDD.log
dmcam_frame_get_gray_u16(dmcam_dev_t *dev, uint16_t *dst, int dst_len,
uint8_t *src, int src_len, const dmcam_frame_info_t *finfo);
| Parameter | Description |
| :-------- | :--------------------------------------- |
| dev | Designated device |
| dst | Destination for the transformed gray data |
| dst_len | Buffer size of gray data |
| src | Original data obtained |
| src_len | Size of original data |
| finfo | Information of original frame |
#### 3.2.10 Acquire pointcloud data
~~~C
dmcam_frame_get_pcl(dmcam_dev_t * dev, float *pcl, int pcl_len,
const float *dist, int dist_len, int img_w, int img_h, const dmcam_camera_para_t *p_cam_param);
Parameter
Description
dev
Designated device
pcl
Pointcloud data output. Each point's coordinate consists of three elements
dist
Depth data of input image
dist_len
Size of depth data of input image
img_w
Width of depth image
img_h
Height of depth image
p_cam_param
Internal parameter of camera
3.3 Introduction on relevant samples
The main samples provided by SmartToF SDK are following: