Subversion Repositories seema-scanner

Rev

Rev 1 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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