forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline.m
56 lines (55 loc) · 2.33 KB
/
pipeline.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
48
49
50
51
52
53
54
55
56
% Wraps librealsense2 pipeline class
classdef pipeline < handle
properties (SetAccess = protected, Hidden = true)
objectHandle;
end
methods
% Constructor
function this = pipeline(ctx)
if nargin == 0
this.objectHandle = realsense.librealsense_mex('rs2::pipeline', 'new');
else
validateattributes(ctx, {'realsense.context'}, {'scalar'});
this.objectHandle = realsense.librealsense_mex('rs2::pipeline', 'new', ctx.objectHandle);
end
end
% Destructor
function delete(this)
if (this.objectHandle ~= 0)
realsense.librealsense_mex('rs2::pipeline', 'delete', this.objectHandle);
end
end
% Functions
function pipeline_profile = start(this, config)
narginchk(1, 2);
if nargin == 1
out = realsense.librealsense_mex('rs2::pipeline', 'start', this.objectHandle);
else
validateattributes(config, {'realsense.config'}, {'scalar'}, '', 'config', 2);
out = realsense.librealsense_mex('rs2::pipeline', 'start', this.objectHandle, config.objectHandle);
end
pipeline_profile = realsense.pipeline_profile(out);
end
function stop(this)
realsense.librealsense_mex('rs2::pipeline', 'stop', this.objectHandle);
end
function frames = wait_for_frames(this, timeout_ms)
narginchk(1, 2);
if nargin == 1
out = realsense.librealsense_mex('rs2::pipeline', 'wait_for_frames', 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::pipeline', 'wait_for_frames', this.objectHandle, double(timeout_ms));
end
frames = realsense.frameset(out);
end
% TODO: poll_for_frames
function profile = get_active_profile(this)
out = realsense.librealsense_mex('rs2::pipeline', 'get_active_profile', this.objectHandle);
realsense.pipeline_profile(out);
end
end
end