Overlay visual stimuli on to a video
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Joanna Scanlon
el 27 de Oct. de 2016
Comentada: Joanna Scanlon
el 9 de Nov. de 2016
I'm currently using Psychtoolbox to attempt to write a visual task on top of a video background, and looking at EEG patterns and response times. I'm currently attempting to adapt the Demo function "DetectionRTInVideoDemo" to do this and not having much luck. Could anyone tell me if there is a way to either 1. create a transparent screen where stimuli can be placed while still viewing the video underneath, or 2. placing small pictures (e.g. small circles) over top of the texture at certain times in the video ?
0 comentarios
Respuesta aceptada
Mihaela Duta
el 4 de Nov. de 2016
If you need an image with transparent background, you can create it in other packages, for example GIMP
In your script, you first need to read the image with the transparent background together with the information about the alpha channel:
[img_data ~ img_alpha] = imread(img_fname); img_data(:,:,4) = img_alpha(:,:);
When opening the psychtoolbox window, enable alpha blending
Screen('BlendFunction', theWindow, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Create the texture for the image
img_tex = Screen('MakeTexture', win, double(img_data));
In the main loop of movie playback, overlay the image texture over every movie texture
Screen('DrawTexture', win, movietexture);
Screen('DrawTexture', win, img_tex);
3 comentarios
Walter Roberson
el 8 de Nov. de 2016
[imdata, imgmap, imgalpha] = imread(...)
You appear to be using R2008b or earlier
Más respuestas (1)
Walter Roberson
el 27 de Oct. de 2016
If you were drawing in MATLAB instead of using the Psychtoolbox drawing routines, then you could place image() objects on top of the display (set the sorting order to be sure it is on top; see http://blogs.mathworks.com/graphics/2014/11/04/sortmethod/) . Set the AlphaData channel of the image objects to 0 in the places where what is behind is to show through and set it to 1 in the places where the overlay stimulus is to show.
0 comentarios
Ver también
Categorías
Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!