Hi all,
I have a question regarding presentation of stimuli but I couldn’t find an answer online or in the Psychtoolbox Demos.
I am using Matlab R2021a and PTB 3.0.17 on a Windows 10 operating system.
What I want to achieve is to present a video that runs for a specific time and simultaneously flash additional static pictures but only for shorter durations. So for example I show a video for 30 seconds and additionally in the periods from 3-5sec., 8-11sec., 15-17sec. etc. I want to present images in addition to the actual movie.
You can also think about it as having two layers of display. On the lower layer (=background) the video runs while on the higher layer the images are shown in addition to the video.
I can show images and show a movie using Screen(DrawTexture) but I can’t show them at the same time. The code I have so far is the following:
while ~KbCheck
% Wait for next movie frame, retrieve texture handle to it
tex = Screen('GetMovieImage', win, movie);
% Valid texture returned? A negative value means end of movie reached:
if tex<=0
% We're done, break out of loop:
break;
end
% Draw the new texture immediately to screen:
Screen('DrawTexture', win, tex);
% this would be a static image for example
curr.image = imread('myimage.bmp');
curr.texture = Screen('MakeTexture', win, curr.image);
Screen('DrawTexture', win, curr.texture, [], []);
curr.image = imread('pain.bmp');
curr.texture = Screen('MakeTexture', win, curr.image);
Screen('DrawTexture', win, curr.texture, [], []);
%Screen('Flip', win);
%WaitSecs(5);
% Update display:
Screen('Flip', win);
% Release texture:
Screen('Close', tex);
end
What this code does at the moment is show the video and from the beginning also show the image overlayed. But I can’t add more pictures or create a timeline for when those pictures need to be shown.
I would very much appreciate your help!
Thanks a lot