Ah, that did seem to help some - thanks! Unfortunately, though, when I repeat the same commands for my second frame (I only have 2 total), the movie I end up with only shows the first frame correctly, and a gray screen for the other. All I changed in my second frame was the file name and the end to "Frames(:,2) = getframe" since I figured the rest of the commands should stay the same. Am I wrong in that assumption, though?
Movie via Frames from Loaded Images
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
0 Kommentare
Akzeptierte Antwort
Kate Godwin
am 15 Aug. 2011
4 Kommentare
Walter Roberson
am 18 Aug. 2011
Sorry, by the time I get "images" in my work, they have been converted to datasets and features extracted and so on, so I just get feature vectors to classify that might have come from anything. I have not done any animation work since before 1980, and most of what I know about "image processing" has come from reading what Image Analyst has written and seeing how he solves problems.
Techniques such as reading images directly in to a Frames structure are, to me, merely routine data structure manipulations based upon experience.
Weitere Antworten (1)
Walter Roberson
am 15 Aug. 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.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!