forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.m
131 lines (130 loc) · 8.91 KB
/
config.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
% Wraps librealsense2 config class
classdef config < handle
properties (SetAccess = private, Hidden = true)
objectHandle;
end
methods
% Constructor
function this = config()
this.objectHandle = realsense.librealsense_mex('rs2::config', 'new');
end
% Destructor
function delete(this)
if (this.objectHandle ~= 0)
realsense.librealsense_mex('rs2::config', 'delete', this.objectHandle);
end
end
% Functions
function enable_stream(this, varargin)
narginchk(2, 7);
validateattributes(varargin{1}, {'realsense.stream', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.stream.count)}, '', 'stream_type', 2);
which = 'none';
switch nargin
case 2
which = 'enable_stream#stream';
case 3
if isa(varargin{2}, 'realsense.format')
validateattributes(varargin{2}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 3);
which = 'enable_stream#format';
else
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'real', 'integer'}, '', 'stream_index', 3);
which = 'enable_stream#stream';
end
case 4
if isa(varargin{2}, 'realsense.format')
validateattributes(varargin{2}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 3);
validateattributes(varargin{3}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'framerate', 4);
which = 'enable_stream#format';
elseif isa(varargin{3}, 'realsense.format')
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'real', 'integer'}, '', 'stream_index', 3);
validateattributes(varargin{3}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 4);
which = 'enable_stream#extended';
else
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'width', 3);
validateattributes(varargin{3}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'height', 4);
which = 'enable_stream#size';
end
case 5
if isa(varargin{3}, 'realsense.format')
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'real', 'integer'}, '', 'stream_index', 3);
validateattributes(varargin{3}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 4);
validateattributes(varargin{4}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'framerate', 5);
which = 'enable_stream#extended';
elseif isa(varargin{4}, 'realsense.format')
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'width', 3);
validateattributes(varargin{3}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'height', 4);
validateattributes(varargin{4}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 5);
which = 'enable_stream#size';
else
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'real', 'integer'}, '', 'stream_index', 3);
validateattributes(varargin{3}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'width', 4);
validateattributes(varargin{4}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'height', 5);
which = 'enable_stream#full';
end
case 6
if isa(varargin{4}, 'realsense.format')
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'width', 3);
validateattributes(varargin{3}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'height', 4);
validateattributes(varargin{4}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 5);
validateattributes(varargin{5}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'framerate', 6);
which = 'enable_stream#size';
else
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'real', 'integer'}, '', 'stream_index', 3);
validateattributes(varargin{3}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'width', 4);
validateattributes(varargin{4}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'height', 5);
validateattributes(varargin{5}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 6);
which = 'enable_stream#full';
end
case 7
validateattributes(varargin{2}, {'numeric'}, {'scalar', 'real', 'integer'}, '', 'stream_index', 3);
validateattributes(varargin{3}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'width', 4);
validateattributes(varargin{4}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'height', 5);
validateattributes(varargin{5}, {'realsense.format', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.format.count)}, '', 'format', 6);
validateattributes(varargin{6}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'framerate', 7);
which = 'enable_stream#full';
end
args = {size(varargin)};
for i = 1:length(varargin)
args{i} = int64(varargin{i});
end
realsense.librealsense_mex('rs2::config', which, this.objectHandle, args{:});
end
function enable_all_streams(this)
realsense.librealsense_mex('rs2::config', 'enable_all_streams', this.objectHandle);
end
function enable_device(this, serial)
narginchk(2, 2);
validateattributes(serial, {'char', 'string'}, {'scalartext'}, '', 'serial', 2);
realsense.librealsense_mex('rs2::config', 'enable_device', this.objectHandle, serial);
end
function enable_device_from_file(this, file_name, repeat_playback)
narginchk(2, 3);
validateattributes(file_name, {'char', 'string'}, {'scalartext'}, '', 'file_name', 2);
if nargin==2
realsense.librealsense_mex('rs2::config', 'enable_device_from_file', this.objectHandle, file_name);
else
validateattributes(repeat_playback, {'logical', 'numeric'}, {'scalar', 'real'}, '', 'repeat_playback', 3);
realsense.librealsense_mex('rs2::config', 'enable_device_from_file', this.objectHandle, file_name, logical(repeat_playback));
end
end
function enable_record_to_file(this, file_name)
narginchk(2, 2);
validateattributes(file_name, {'char', 'string'}, {'scalartext'}, '', 'file_name', 2);
realsense.librealsense_mex('rs2::config', 'enable_record_to_file', this.objectHandle, file_name);
end
function strm = disable_stream(this, stream, index)
narginchk(2, 3);
validateattributes(stream, {'realsense.stream', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', int64(realsense.stream.count)}, '', 'stream', 2);
if nargin == 2
out = realsense.librealsense_mex('rs2::config', 'disable_stream', this.objectHandle, int64(stream));
else
validateattributes(index, {'numeric'}, {'scalar', 'real', 'integer'}, '', 'index', 3);
out = realsense.librealsense_mex('rs2::config', 'disable_stream', this.objectHandle, int64(stream), int64(index));
end
strm = realsense.stream_profile(out{:});
end
function disable_all_streams(this)
realsense.librealsense_mex('rs2::config', 'disable_all_streams', this.objectHandle);
end
end
end