Subversion Repositories seema-scanner

Rev

Rev 28 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28 Rev 255
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
29
            % check input
30
            if(size(texture,3) ~= 3 || ~isa(texture, 'uint8'))
30
            if(size(texture,3) ~= 3 || ~isa(texture, 'uint8'))
31
                error('Input must be [r x c x 3] of type uint8');
31
                error('Input must be [r x c x 3] of type uint8');
32
            end
32
            end
33
            height = size(texture, 1);
33
            height = size(texture, 1);
34
            width = size(texture, 2);
34
            width = size(texture, 2);
35
            % swivel data to match RMO OpenGL format
35
            % swivel data to match RMO OpenGL format
36
            texture = permute(texture, [3 2 1]);
36
            texture = permute(texture, [3 2 1]);
-
 
37
            size(texture)
37
            [varargout{1:nargout}] = ProjectorMex('displayTexture', this.objectHandle, texture, width, height);
38
            [varargout{1:nargout}] = ProjectorMex('displayTexture', this.objectHandle, texture, width, height);
38
        end
39
        end
39
   
40
   
40
        % displayWhite
41
        % displayWhite
41
        function varargout = displayWhite(this)
42
        function varargout = displayWhite(this)
42
            [varargout{1:nargout}] = ProjectorMex('displayWhite', this.objectHandle);
43
            [varargout{1:nargout}] = ProjectorMex('displayWhite', this.objectHandle);
43
        end
44
        end
44
        
45
        
45
        % displayBlack
46
        % displayBlack
46
        function varargout = displayBlack(this)
47
        function varargout = displayBlack(this)
47
            [varargout{1:nargout}] = ProjectorMex('displayBlack', this.objectHandle);
48
            [varargout{1:nargout}] = ProjectorMex('displayBlack', this.objectHandle);
48
        end
49
        end
49
        
50
        
50
        % setGamma
51
        % setGamma
51
        function varargout = SetGamma(this, gamma)
52
        function varargout = SetGamma(this, gamma)
52
            [varargout{1:nargout}] = ProjectorMex('SetGamma', this.objectHandle, gamma);
53
            [varargout{1:nargout}] = ProjectorMex('SetGamma', this.objectHandle, gamma);
53
        end
54
        end
54
 
55
 
55
    end
56
    end
56
end
57
end
57
 
58