change0618 (站内联系TA)
>> a=1:8
a =
1 2 3 4 5 6 7 8
>> a(a> a=1:8
a =
1 2 3 4 5 6 7 8
>> a(a> help read
--- help for mmreader/read ---
READ Read a multimedia file.
VIDEO = READ(OBJ) reads in video frames from the associated file. VIDEO
is an H x W x B x F matrix where H is the image frame height, W is the
image frame width, B is the number of bands in the image (e.g. 3 for RGB),
and F is the number of frames read in. The default behavior is to read in
all frames unless an index is specified. The type of data returned is
always UINT8 data representing RGB24 video frames.
VIDEO = READ(...,INDEX) performs the same operation, but reads only the
frame(s) specified by INDEX, where the first frame number is 1. INDEX can
be a single index, or a two-element array representing an index range
of the video stream.
For example:
VIDEO = READ(OBJ); % Read in all video frames.
VIDEO = READ(OBJ, 1); % Read only the first frame.
VIDEO = READ(OBJ, [1 10]); % Read the first 10 frames.
If any invalid INDEX is specified, MATLAB throws an error.
Example:
% Construct a multimedia reader object associated with file 'xylophone.mpg' with
% user tag set to 'myreader1'.
readerobj = mmreader('xylophone.mpg', 'tag', 'myreader1');
% Read in all video frames.
vidFrames = read(readerobj);
% Get the number of frames.
numFrames = get(readerobj, 'numberOfFrames');
% Create a MATLAB movie struct from the video frames.
for k = 1 : numFrames
mov(k).cdata = vidFrames(:,:,:,k);
mov(k).colormap = [];
end
% Create a figure
hf = figure;
% Resize figure based on the video's width and height
set(hf, 'position', [150 150 readerobj.Width readerobj.Height])
% Playback movie once at the video's frame rate
movie(hf, mov, 1, readerobj.FrameRate);
See also audiovideo, movie, mmreader, mmreader/get, mmreader/set, mmfileinfo.
Overloaded methods:
vdspdebug/read
eclipseide/read
ghsmulti/read
daitem/read
dagroup/read
rfckt.read
vrjoystick/read
ccsdebug/read
wptree/read
wdectree/read
dtree/read
Reference page in Help browser
doc mmreader/read
>>