/usr/share/psychtoolbox-3/PsychHardware/iViewXToolbox/tempBMP.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
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 | % generate calibration bmps
try
myimgdir='tempbmps';
clear ivx;
makecolorim=0;
makehighcontrastim=0;
whitemarkers=1;
colors=[255 255 255; 255 0 0; 0 255 0; 0 0 255; 255 255 0;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255;255 255 255];
screenNumber=max(Screen('Screens'))
[w, screenRect]=Screen('OpenWindow', screenNumber, 0, [],32,2);
WindowSize(w)
white=WhiteIndex(screenNumber);
black=BlackIndex(screenNumber);
% gray=round((white+black)/2);
gray=GrayIndex(screenNumber);
Screen('FillRect',w, gray);
Screen('Flip',w);
ivx=iViewXInitDefaults(w);
points=5;
shift=[0 0];
scale=35;
scale=[scale scale];
ivx=iViewXSetCalPoints(ivx, points, shift, scale);
[dummy,dummy]=mkdir(myimgdir);
fprintf('Generating calibration BMP using %d points.\n', ivx.nCalPoints);
if 0==makehighcontrastim
Screen('FillRect',w, gray);
else
Screen('FillRect',w, black);
end
for i=1:ivx.nCalPoints
point=ivx.absCalPos(i,:);
rect=CenterRectOnPoint(ivx.calRect, point(1), point(2));
f=8;
brect=ScaleRect(rect,f,f);
brect=CenterRectOnPoint(brect, point(1), point(2));
if 0==makecolorim
mycrosscolor=ivx.calPointColour;
mycolor=ivx.calPointColour;
else
mycrosscolor=squeeze(colors(i,:));
if whitemarkers==1
mycolor=ivx.calPointColour;
else
mycolor=squeeze(colors(i,:));
end
end
Screen('DrawLine', w, mycrosscolor, brect(1), brect(2), brect(3), brect(4) ,8);
Screen('DrawLine', w, mycrosscolor, brect(1), brect(4), brect(3), brect(2) ,8);
Screen('FillOval',w, mycolor, rect);
rect=CenterRectOnPoint(ivx.calRectCenter, point(1), point(2));
Screen('FillOval',w, ivx.calPointColourCenter, rect);
end
% Screen('Flip',w);
% WaitSecs(1);
% we need to get the image before the flip
if 1 imageArray=Screen('GetImage', w ); end
Screen('Flip',w);
if 0 imageArray=Screen('GetImage', w ); end
[w2, screenRect2]=Screen('OpenWindow', 0, 0, [],32,2);
if 1 imageArray2=Screen('GetImage', w2 ); end
Screen('FillRect',w2, [128 128 0]);
% Screen('Flip',w2);
Screen('PutImage', w2, imageArray);
Screen('Flip',w2);
Screen('FillRect',w, black);
Screen('PutImage', w, imageArray2);
Screen('Flip',w);
WaitSecs(1);
type='bmp';
[h v]=WindowSize(w);
Screen('CloseAll');
imtype='XXX';
if makecolorim==1
if makehighcontrastim==1
imtype='BCX';
elseif makehighcontrastim==0
imtype='GCX';
end
elseif makecolorim==0
if makehighcontrastim==1
imtype='BWX';
elseif makehighcontrastim==0
imtype='GWX';
end
end
imgname=[num2str(ivx.nCalPoints) 'pt' num2str(h) 'x' num2str(v) 'off' num2str(shift(1)) 'x' num2str(shift(2)) 'sc' num2str(scale(1)) 'x' num2str(scale(2)) imtype ];
imgpath=[myimgdir filesep imgname '.bmp'];
fprintf('Saving BMP to %s\n', imgpath);
imwrite(imageArray, imgpath, 'bmp');
fprintf('\nEnd of image generation.\n');
catch
%this "catch" section executes in case of an error in the "try" section
%above. Importantly, it closes the onscreen window if its open.
% pnet('closeall');
Screen('CloseAll'); rethrow(lasterror);
end %try..catch..
|