Subversion Repositories seema-scanner

Rev

Rev 1 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 28
1
%PROJECTOR Matlab wrapper class for the Projector C++ class.
1
%PROJECTOR Matlab wrapper class for the Projector C++ class.
2
% Creates a fullscreen OpenGL context for the screen specified for fast
2
% Creates a fullscreen OpenGL context for the screen specified for fast
3
% texture or pattern projection.
3
% texture or pattern projection.
4
%
4
%
5
% Jakob Wilm, DTU 2013
5
% Jakob Wilm, DTU 2013
6
 
6
 
7
classdef Projector < handle
7
classdef Projector < handle
8
    properties (SetAccess = private, Hidden = true)
8
    properties (SetAccess = private, Hidden = true)
9
        objectHandle; % Handle to the underlying C++ class instance
9
        objectHandle; % Handle to the underlying C++ class instance
10
    end
10
    end
11
    methods (Static = true)
11
    methods (Static = true)
12
        function varargout = GetScreenInfo
12
        function varargout = GetScreenInfo
13
            [varargout{1:nargout}] = ProjectorMex('GetScreenInfo');
13
            [varargout{1:nargout}] = ProjectorMex('GetScreenInfo');
14
        end
14
        end
15
    end
15
    end
16
    methods
16
    methods
17
        % Constructor - Create a new C++ class instance 
17
        % Constructor - Create a new C++ class instance 
18
        function this = Projector(screenNum)
18
        function this = Projector(screenNum)
19
            this.objectHandle = ProjectorMex('new', screenNum);
19
            this.objectHandle = ProjectorMex('new', screenNum);
20
        end
20
        end
21
        
21
        
22
        % Destructor - Destroy the C++ class instance
22
        % Destructor - Destroy the C++ class instance
23
        function delete(this)
23
        function delete(this)
24
            ProjectorMex('delete', this.objectHandle);
24
            ProjectorMex('delete', this.objectHandle);
25
        end
25
        end
26
 
26
 
27
        % displayTexture
27
        % displayTexture
28
        function varargout = displayTexture(this, texture)
28
        function varargout = displayTexture(this, texture)
-
 
29
            % check input
-
 
30
            if(size(texture,3) ~= 3 || ~isa(texture, 'uint8'))
-
 
31
                error('Input must be [r x c x 3] of type uint8');
-
 
32
            end
29
            height = size(texture, 1);
33
            height = size(texture, 1);
30
            width = size(texture, 2);
34
            width = size(texture, 2);
31
            % swivel data to match RMO OpenGL format
35
            % swivel data to match RMO OpenGL format
32
            texture = permute(texture, [3 2 1]);
36
            texture = permute(texture, [3 2 1]);
33
            [varargout{1:nargout}] = ProjectorMex('displayTexture', this.objectHandle, texture, width, height);
37
            [varargout{1:nargout}] = ProjectorMex('displayTexture', this.objectHandle, texture, width, height);
34
        end
38
        end
35
   
39
   
36
        % displayWhite
40
        % displayWhite
37
        function varargout = displayWhite(this)
41
        function varargout = displayWhite(this)
38
            [varargout{1:nargout}] = ProjectorMex('displayWhite', this.objectHandle);
42
            [varargout{1:nargout}] = ProjectorMex('displayWhite', this.objectHandle);
39
        end
43
        end
40
        
44
        
41
        % displayBlack
45
        % displayBlack
42
        function varargout = displayBlack(this)
46
        function varargout = displayBlack(this)
43
            [varargout{1:nargout}] = ProjectorMex('displayBlack', this.objectHandle);
47
            [varargout{1:nargout}] = ProjectorMex('displayBlack', this.objectHandle);
44
        end
48
        end
45
        
49
        
46
        % setGamma
50
        % setGamma
47
        function varargout = SetGamma(this, gamma)
51
        function varargout = SetGamma(this, gamma)
48
            [varargout{1:nargout}] = ProjectorMex('SetGamma', this.objectHandle, gamma);
52
            [varargout{1:nargout}] = ProjectorMex('SetGamma', this.objectHandle, gamma);
49
        end
53
        end
50
 
54
 
51
    end
55
    end
52
end
56
end
53
 
57