Clear Filters
Clear Filters

Display Undistortion : problems loading config file

3 views (last 30 days)
Hi everyone
I use the Psychtoolbox to display some stimuli with a projector, on a curbed screen.
I need correct the (multiple) distortion of the image. I used "DisplayUndistortionBVL" to generate the "undistortion config file". The file generation is ok.
Now.. I load the file as indicated, but when I draw sometings, the distortion is not corrected (I have no changes! I have no error notification)
Could someone help me, please ..?
Thanks in advance
- - -
Here the code:
%%Screen dimension
ScreenXpix = 1024 ;
ScreenYpix = 768 ;
centroschermo = [ (ScreenXpix/2) (ScreenYpix/2) ] ;
--------------- PARAMETERS and initialization ----------------%
flipSpdwindow = 0;
whichScreen = 1; % working window ----------
rcD = 1; % duration of the Red Cross Fixation presentation [sec]
data = [];
%%--------------------- COLORS -------------------------%
white = [255 255 255];
gray = [128 128 128];
Dgray = [54 54 54];
black = [0 0 0];
blue = [100 100 250];
red = [200 50 50];
green = [21 152 18];
%%--------------------- Open Working Window ---------------------%
% on line window
rec = Screen('Rect',whichScreen); % Screen selection
[W, H]=Screen('WindowSize', whichScreen);
*% Display Undistortion BVL
% [window, rect] = Screen('OpenWindow', whichScreen, black, rec); % Apre la finestra grafica
PsychImaging('PrepareConfiguration');
PsychImaging('AddTask', 'AllView', 'GeometryCorrection', 'C:\Documents and Settings\acarlini\Application Data\Psychtoolbox\GeometryCalibration\BVLCalibdata_1_1280_1024.mat', 0, 73 , 53) ;
[window , rect] = PsychImaging('OpenWindow', whichScreen, black, rec);*
monitorFlipInterval = Screen('GetFlipInterval', window); % Frequenza di refresh del display
% Screen center
centroschermo = (rec (3:4) ) /2 ;
Window corners
% Up Left
Screen('FillRect',window, blue , [ 0 , 0 , 50 , 50] ) ;
Screen('FillRect',window, black , [ 10 , 10 , 50 , 50] ) ;
% Up Right
Screen('FillRect',window, blue , [ rect(3)-50 , 0 , rect(3) , 50] ) ;
Screen('FillRect',window, black , [ rect(3)-50 , 10 , rect(3)-10 , 50 ] ) ;
% Down Left
Screen('FillRect',window, blue , [ 0 , rect(4)-50 , 50 , rect(4)] ) ;
Screen('FillRect',window, black , [ 10 , rect(4)-50 , 50 , rect(4)-10] ) ;
% Down Right
Screen('FillRect',window, blue , [ rect(3)-50 , rect(4)-50 , rect(3) , rect(4)] ) ;
Screen('FillRect',window, black , [ rect(3)-50 , rect(4)-50 , rect(3)-10 , rect(4)-10] ) ;
% Up
Screen('FillRect',window, blue , [ (round(rect(3)/2)-25) , 0 , (round(rect(3)/2)+25) , 10 ] ) ;
Screen('FillRect',window, white , [ (round(rect(3)/2)-2) , 0 , (round(rect(3)/2)+2) , 10 ] ) ;
% Down
Screen('FillRect',window, blue , [ (round(rect(3)/2)-25) , rect(4)-10 , (round(rect(3)/2)+25) , rect(4) ] ) ;
Screen('FillRect',window, white , [ (round(rect(3)/2)-2) , rect(4)-10 , (round(rect(3)/2)+2) , rect(4) ] ) ;
% Left
Screen('FillRect',window, blue , [ 0 , (round(rect(4)/2)-25) , 10 , (round(rect(4)/2)+25) ] ) ;
% Right
Screen('FillRect',window, blue , [ rect(3)-10 , (round(rect(4)/2)-25) , rect(3) , (round(rect(4)/2)+25) ] ) ;
% Center
dim_cross = 8 ; % Larghezza della croce attentiva, in pixel
spex_cross = 3 ; % Spessore linea della croce attentiva, in pixel
Screen('DrawLine', window , red , centroschermo(1) - dim_cross , centroschermo(2) - dim_cross , centroschermo(1) + dim_cross , centroschermo(2) + dim_cross , spex_cross ) ;
Screen('DrawLine', window , red , centroschermo(1) + dim_cross , centroschermo(2) - dim_cross , centroschermo(1) - dim_cross , centroschermo(2) + dim_cross , spex_cross ) ;
Screen('Flip', window);
%%Mouse clilck
pmb = 0 ;
while pmb == 0
[Xmouse,Ymouse,buttons] = GetMouse() ;
if any(buttons)
fprintf('Someone''s pressing a mouse button!\n');
MouseClick = [clock,buttons,Xmouse,Ymouse] ;
pmb = 1 ;
end
end
%% -------------- Close PSICHTOOLBOX Working Window ----------%
Screen('CloseAll');
  2 Comments
Walter Roberson
Walter Roberson on 16 Dec 2011
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!