This file is indexed.

/usr/share/psychtoolbox-3/PsychVideoCapture/PsychSetupCamera.m is in psychtoolbox-3-common 3.0.9+svn2579.dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
function PsychSetupCamera(camsettingsfile, rate, fullscreen)
% PsychSetupCamera(camsettingsfile, rate)
% 
% Setup basic camera settings like exposure time, brightness and gain.
%
% The routine loads camera settings from 'camsettingsfile' if it
% exists, otherwise it uses the cameras default settings.
%
% Then it runs a video loop at 'rate' frames per second.
%
% During the loop, the user can change settings by pressing:
%
% 'Cursor left' and 'Cursor right' keys to decrease or increase
% exposure time.
%
% 'Cursor up' and 'Cursor down' to increase or decrease camera gain.
%
% 'b' and 'd' to increase or decrease brightness setting.
%
% 'w' to write the current settings to 'camsettingsfile', overwriting
% the old file, if it already exists.
%
% 'ESC'ape key to finish setup.
%
% If no rate is given, the loop runs at 30 Hz.
% If no filename is given, 'CamSettings.mat' is read/written from
% the current working directory.

% History:
% 06/04/06 Written. (MK)

if nargin < 1
   camsettingsfile = 'CamSettings.mat'
end

if nargin < 2
   rate = 30;
end

if nargin < 3
   fullscreen = 0;
end

if IsOctave
   % Disable Octaves output pager.
   more off;

   % Tell Octave to not check timestamps of all M-Files
   % on each invocation -- Saves *a lot* of overhead.
   oldIgnore = ignore_function_time_stamp('all');
end

% Open fullscreen onscreen window with black background
% and everything else at default settings on display 0.
if fullscreen
   win = Screen('OpenWindow', 0, 0);
else
   win = Screen('OpenWindow', 0, 0, [0 0 640 480]);
end

PsychVideoDelayLoop('Verbosity', 2);

% Open video capture device for display in window 'win'.
% We use the default device at default ROI (640 x 480)
% and default color mode.
grabber = PsychVideoDelayLoop('Open', win);

% Measure device capture rate at a requested 'rate' fps,
% tune-in display for optimal presentation.
PsychVideoDelayLoop('TuneVideoRefresh', rate);

% Set abort keys to Escape and 'w':
PsychVideoDelayLoop('SetAbortKeys', [KbName('Escape') , KbName('w')]);

% Set presentation to full field of view, non-mirrored, upside:
PsychVideoDelayLoop('SetPresentation', 1, 0, 0);

% Define time margin for processing and drift correction:
% 9.2 ms are a good value for 60 Hz on a P4 2.2 Ghz...
%PsychVideoDelayLoop('SetHeadstart', 0.0092);
PsychVideoDelayLoop('SetHeadstart', 0.018);

% Enable full logging.
PsychVideoDelayLoop('SetLogging', 1);

% Disable recording:
PsychVideoDelayLoop('RecordFrames', 0);

% Load current camera settings from file:
if exist(camsettingsfile)
   load(camsettingsfile);
   oldcamsettings = PsychCamSettings('SetAllSettings', grabber, camsettings)
   newcamsettings = PsychCamSettings('GetAllSettings', grabber)
end

finish=0;
savesettings=0;

while ~finish
  % Run video loop at req. settings until keypress or timeout:
  rc = PsychVideoDelayLoop('RunLoop', 0, 1);

  % Blank screen at end:
  Screen('Flip', win);

  % Retrieve logs:
  timestamps = PsychVideoDelayLoop('GetLog');

  % Pressing 'Escape' aborts the whole procedure:
  finish = rc.keycode(KbName('Escape'));

  % Pressing 'w' saves the current cam settings to the file:
  savesettings = rc.keycode(KbName('w'));
  if savesettings
     % Save current camera settings to file:
     camsettings = PsychCamSettings('GetAllSettings', grabber)
     save('-mat', camsettingsfile, 'camsettings');
  end;
end;

% Close delay loop, release grabber:
PsychVideoDelayLoop('Close');

% Close all textures and onscreen windows:
Screen('CloseAll');

if IsOctave
   % Reenable timestamp checking.
   ignore_function_time_stamp(oldIgnore);
end

% Plot final timing stats:
delay=0;
plot(timestamps(3,delay+1:end)*1000,';real_delay;', timestamps(2,delay+1:end)*1000, ';cts_to_vbl_delay;');

% For the stats, we throw away the first 4 frames:
statstart = max(delay+1, 4);

mindelay = min(timestamps(3,statstart:end)*1000);
maxdelay = max(timestamps(3,statstart:end)*1000);
meandelay = mean(timestamps(3,statstart:end)*1000);
stddevdelay = std(timestamps(3,statstart:end)*1000);
fprintf('Mindelay %f ms.\n', mindelay);
fprintf('Maxdelay %f ms.\n', maxdelay);
fprintf('Meandelay %f ms, stddev = %f ms.\n', meandelay, stddevdelay);

% Done!
end