Movie via Frames from Loaded Images
Afficher commentaires plus anciens
I am trying to design a basic visual stimulus (full-field vertical grating with contrast reversal), but am very new to MATLAB. I have created the images I want to use as frames and saved them as jpegs, but when I have tried to use the code to turn these into a movie, I just get a gray screen as my result. If anyone sees what I am doing wrong, I would greatly appreciate any help/guidance.
Here is my code:
reruns = 10;
fps = 4;
nframes = 2;
Frames = moviein(nframes);
load VerticalBars1.jpg
Frames(:,1) = getframe;
load VerticalBars2.jpg
Frames(:,2) = getframe;
movie(Frames, reruns, fps)
Thanks so much in advance for any help you can provide!
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 15 Août 2011
load() of an image does not display it on the screen for getframe() to be able to operate on it.
Also, it is better to imread() than to load() when you are working with images.
[img, immap] = imread('VerticalBars1.jpg');
image(img);
if ~isempty(immap); colormap(immap); end
Frame(:,1) = getframe;
and so on.
Catégories
En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!