Display Undistortion : problems loading config file

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);

%%% [window, rect] = Screen('OpenWindow', whichScreen, black, rec);

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);

% Screen center
centroschermo = (rec (3:4) ) /2 ;


%% Draws Window corners - to test the correction
% 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 ; % Cross dimension, in pixel
spex_cross = 3 ; % Cross'line dimension, 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');
Thank you for the solution, now it is working !

Now I have a good display… but I find a miscorrelation between the "corrected" display and the mouse click (when I get the click position with GetMouse() or GetClicks() ).

I have the impression that the mouse click follows the original grid, not the corrected-one.

Do you know if it is available a function or a system to solve this problem ?

Thanks in advance !


---------------------------------------------------------------


--- In psychtoolbox@yahoogroups.com, "Mario" <mario.kleiner@...> wrote:
>
> Simple:
>
> PsychImaging('AddTask', 'AllView', 'GeometryCorrection', 'C:\Documents and
> Settings\acarlini\Application
> Data\Psychtoolbox\GeometryCalibration\BVLCalibdata_1_1280_1024.mat', 0, 73 , 53)
> ;
>
> --> 'AllViews', not 'AllView'. The parser silently ignores that 'AddTask' statement with unknown keyword.
>
> Btw. <http://docs.psychtoolbox.org/GetClicks> may come handy for waiting for mouse clicks.
>
> -mario
>
> --- In psychtoolbox@yahoogroups.com, "c_drago" <alex_carlini@> wrote:
> >
> > 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);
> >
> > %%% [window, rect] = Screen('OpenWindow', whichScreen, black, rec);
> >
> > 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);
> >
> > % Screen center
> > centroschermo = (rec (3:4) ) /2 ;
> >
> >
> > %% Draws Window corners - to test the correction
> > % 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 ; % Cross dimension, in pixel
> > spex_cross = 3 ; % Cross'line dimension, 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');
> >
>