I'm trying to figure out how to use cdata under Movie function in MATLAB. Can any expert please give me a short explanation? Thank you!
As you can find in the MOVIE function documentation, it plays a movie, which is actually an array of frames. Frame in its turn is a single "shot", or still image, represented in MATLAB by a structure with fields cdata (matrix of pixels data) and colormap (if used).
You can create a frame from current figure with GETFRAME function: F = getframe;
. F.cdata
will be an image matrix H x W x 3, with 3rd dimension representing 3 color channels - red, green and blue. You can show it with image(F.cdata)
command.
If M
is a movie frames, you can show just the first frame with image(M(1).cdata)
.
I would recommend you to play with examples on the MOVIE and GETFRAME help pages to have a better understanding.