forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame_queue.m
47 lines (45 loc) · 1.93 KB
/
frame_queue.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Wraps librealsense2 frame_queue class
classdef frame_queue < handle
properties (SetAccess = private, Hidden = true)
objectHandle;
end
methods
% Constructor
function this = frame_queue(capacity)
if nargin == 0
this.objectHandle = realsense.librealsense_mex('rs2::frame_queue', 'new');
else
validateattributes(capacity, {'numeric'}, {'scalar', 'positive', 'real', 'integer'});
this.objectHandle = realsense.librealsense_mex('rs2::frame_queue', 'new', uint64(capacity));
end
end
% Destructor
function delete(this)
if (this.objectHandle ~= 0)
realsense.librealsense_mex('rs2::frame_queue', 'delete', this.objectHandle);
end
end
% Functions
function frame = wait_for_frame(this, timeout_ms)
narginchk(1, 2);
if nargin == 1
out = realsense.librealsense_mex('rs2::frame_queue', 'wait_for_frame', this.objectHandle);
else
if isduration(timeout_ms)
timeout_ms = milliseconds(timeout_ms);
end
validateattributes(timeout_ms, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'timeout_ms', 2);
out = realsense.librealsense_mex('rs2::frame_queue', 'wait_for_frame', this.objectHandle, double(timeout_ms));
end
frame = realsense.frame(out);
end
% TODO: poll_for_frame [frame, video_frame, points, depth_frame, disparity_frame, motion_frame, pose_frame, frameset]
function cap = capacity(this)
cap = realsense.librealsense_mex('rs2::frame_queue', 'capacity', this.objectHandle);
end
function keep = keep_frames(this)
cap = realsense.librealsense_mex('rs2::frame_queue', 'keep_frames', this.objectHandle);
end
end
end
end