Azzera filtri
Azzera filtri

making movie file

1 visualizzazione (ultimi 30 giorni)
Rishabh Kasliwal
Rishabh Kasliwal il 22 Apr 2011
Hi All,
I am trying to make a movie file from a image stack. I am using the following sample code (given in MATLAB)
***********************************************************
imgstack = uint16(zeros(32,128,1,no_of_frames));
for frame = 1:no_of_frames
[imgstack(:,:,1,frame)] = imread(filename, frame);
end
map = (linspace(0,64,65))'; map = repmat(map,1,3)/64;
mov = immovie(imagestack,map);
movie2avi(mov,filename)
**********************************************
Few frames (in the middle) have increased intensity in one region. So I expect to see something like a light bulb go on and off. But I notice that it is too bright all over. I want to scale the frames such that max intensity pixel represents 1.0 in colormap and min intensity pixel represent zero (over all frames). In other words the same 'map' is applied universally to all pixels in all frames. How can I do that in the movie? One idea I had is to apply different maps to diff frames, but I dont know how to implement it.
please help
thanks
rishabh

Risposte (1)

Walter Roberson
Walter Roberson il 22 Apr 2011
Without answering your question, here are some efficiency hints:
imgstack = zeros(32,128,1,no_of_frames, 'uint16');
map = ndgrid(0:1/64:1,[0 0 0]);
Specifying a frame number to imread() in the way you have is supported only for .CUR and .GIF files. If you are using .GIF files (but not .CUR files) then you could probably gain a fair bit of efficiency by reading all of the frames in a single call, by specifying 1:nframes as the index. .CUR files only support reading one frame at a time. The only other file type that supports reading frames is TIFF files, for which you must use
imread(filename, 'Index', frame)
and a vector of frames is not permitted for TIFF.

Categorie

Scopri di più su Display Image in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by