forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish matlab half off all classes for initial release, add first exa…
…mple
- Loading branch information
Lior Ramati
committed
Aug 14, 2018
1 parent
7ecf0a5
commit e25691b
Showing
37 changed files
with
948 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
% Wraps librealsense2 align class | ||
classdef align < handle | ||
properties (SetAccess = private, Hidden = true) | ||
objectHandle; | ||
end | ||
methods | ||
% Constructor | ||
function this = align(align_to) | ||
narginchk(1, 1); | ||
validateattributes(align_to, {'realsense.stream', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', realsense.stream.count}); | ||
this.objectHandle = realsense.librealsense_mex('rs2::align', 'new', int64(align_to)); | ||
end | ||
|
||
% Destructor | ||
function delete(this) | ||
if (this.objectHandle ~= 0) | ||
realsense.librealsense_mex('rs2::align', 'delete', this.objectHandle); | ||
end | ||
end | ||
|
||
% Functions | ||
function frames = process(this, frame) | ||
narginchk(2, 2); | ||
validateattributes(frame, {'realsense.frame'}, {'scalar'}, '', 'frame', 2); | ||
if ~frame.is('frameset') | ||
error('Expected input number 2, frame, to be a frameset'); | ||
end | ||
out = realsense.librealsense_mex('rs2::align', 'process', this.objectHandle, frame.objectHandle); | ||
frames = realsense.frame(out); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
% Wraps librealsense2 colorizer class | ||
classdef colorizer < realsense.options | ||
methods | ||
% Constructor | ||
function this = colorizer() | ||
out = realsense.librealsense_mex('rs2::colorizer', 'new'); | ||
this = [email protected](out); | ||
end | ||
|
||
% Destructor (uses base class destructor) | ||
|
||
% Functions | ||
function video_frame = colorize(this, depth) | ||
narginchk(2, 2) | ||
validateattributes(depth, {'realsense.frame'}, {'scalar'}, '', 'depth', 2); | ||
if ~depth.is('depth_frame') | ||
error('Expected input number 2, depth, to be a depth_frame'); | ||
end | ||
out = realsense.librealsense_mex('rs2::colorizer', 'colorize', this.objectHandle, depth.objectHandle); | ||
video_frame = realsense.video_frame(out); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
% Wraps librealsense2 config class | ||
classdef config < handle | ||
properties (SetAccess = private, Hidden = true) | ||
objectHandle; | ||
end | ||
methods | ||
% Constructor | ||
function this = pipeline_profile() | ||
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', '<=', 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'}, {'scalar'}, '', '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'}, {'scalar'}, '', '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'}, {'scalar'}, '', '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'}, {'scalar'}, '', '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'}, {'scalar'}, '', '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'}, {'scalar'}, '', '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', '<=', 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', '<=', realsense.format.count}, '', 'format', 6); | ||
validateattributes(varargin{6}, {'numeric'}, {'scalar', 'nonnegative', 'real', 'integer'}, '', 'framerate', 7); | ||
end | ||
args = num2cell(int64([varargin{:}])); | ||
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, serialv) | ||
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 disable_stream(this, stream, index) | ||
narginchk(2, 3); | ||
validateattributes(stream, {'realsense.stream', 'numeric'}, {'scalar', 'nonnegative', 'real', 'integer', '<=', 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', 'nonnegative', 'real', 'integer'}, '', 'index', 3); | ||
out = realsense.librealsense_mex('rs2::config', 'disable_stream', this.objectHandle, int64(stream), int64(index)); | ||
end | ||
stream = realsense.stream_profile(out{:}); | ||
end | ||
function disable_all_streams(this) | ||
realsense.librealsense_mex('rs2::config', 'disable_all_streams', this.objectHandle); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
% Wraps librealsense2 decimation_filter class | ||
classdef decimation_filter < realsense.process_interface | ||
methods | ||
% Constructor | ||
function this = decimation_filter() | ||
out = realsense.librealsense_mex('rs2::decimation_filter', 'new'); | ||
this = [email protected]_interface(out); | ||
end | ||
|
||
% Destructor (uses base class destructor) | ||
|
||
% Functions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
methods | ||
% Constructor | ||
function this = depth_sensor(handle) | ||
this = [email protected](handle); | ||
this = [email protected](handle); | ||
end | ||
|
||
% Destructor (uses base class destructor) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
methods | ||
% Constructor | ||
function this = depth_stereo_sensor(handle) | ||
this = [email protected]_sensor(handle); | ||
this = [email protected]_sensor(handle); | ||
end | ||
|
||
% Destructor (uses base class destructor) | ||
|
Oops, something went wrong.