Video save and replay instructions¶
In the algorithm evaluation of the module, one of the main preparations before the evaluation is the acquisition of video files. In SmartToFViewer, we have introduced how to obtain it through SmartToFViewer. Record and play, here introduces how to record and read video files through the program, as well as the main introduction to the API
Settings for video files¶
Whether to save the video file and what kind of data the video file saves are mainly set in the program dmcam_cap_cfg_t
structure, the specific code is as follows
/* set capture config */
dmcam_cap_cfg_t cap_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 */
};
Among the above structure parameters, the parameters related to the video file are en_save_replay
en_save_dist_u16
en_save_gray_u16
,
,the specific descriptions of these parameters are as follows:
Support SmartToF SDK standard playback
If you only need to support SmartToF SDK standard playback, just set the above
en_save_replay
totrue
and the other two tofalse
OpenNI-compatible playback (such as NiViewer)
Support playback of OpenNI tools, such as NiViewer playback.In this case, you need to set
en_save_replay
tofalse
,en_save_dist_u16
anden_save_gray_u16
. Set totrue
or any one of the settingstrue
, if both are set to enable, it means to store the depth map and grayscale map, and one of them is enabled to enableen_save_dist_u16
as the depth map, Enablingen_save_gray_u16
means that the saved image is grayscale.
Reading of video files¶
SmartToF video file “xxx.oni” can be simulated as a standard DMCAM device and can be opened by the dmcam_dev_open_by_uri
function,
If the file name is “test.oni”, the code to read the file name is as follows.
dev = dmcam_dev_open_by_uri("test.oni") //or file://test.oni
Caution
The main differences between analog dmcam devices and real dmcam devices are as follows:
When simulating equipment, all processing based on the original DCS data in the SDK can be adjusted and superimposed, such as: depth filtering, minimum amplitude filtering, pixel calibration, lens calibration, etc.
When simulating a device, adjusting related parameters of the DCS raw data is not effective in simulating the device, such as exposure time, HDR function, etc.