The MPEG converter takes a MATLAB movie matrix and writes the movie to disk as an MPEG file.
Author: David Foti
This combination has problems compiling and running mpgwrite:
I got code working with these steps collected from this thread:
1. Download, unzip files, and run makedll.m residing in ./src directory created by zip extraction.
2. move mpgwrite.mexw64 ("the dll") to a directory that DOES NOT have mpgwrite.m in it.
3. Run this script in
directory with mpgwrite.mexw64 NOTE: The 3 programs above generate frames of different sizes and frames must be resized. Here is an example:
% adapted from http://www.math.canterbury.ac.nz/~c.scarrott/MATLAB_Movies/movies.html
A=moviein(numframes); % create the movie matrix
axis equal % fix the axes
%movie(A,10,3) % Play MATLAB movie
%save movie.mat A
%%% bug fix
% VS2008 and Matlab 22.214.171.1244 generate 25% of frames with different
% dimensions. Assume first frame is correct.
[r1,c1,s] = size(A(1).cdata);
for i = 2:length(A)
[rk,ck] = size(A(i).cdata);
if (rk~= r1 | ck ~=c1)
A(i).cdata = A(i).cdata(1:r1, 1:c1,:);
% compare frame sizes
for i = 1:numframes
fprintf(1,'%d %d %d\n',i,size(A(i).cdata,1),size(A(i).cdata,2));
4. resulting .mpg video file playable in Windows 7 Media Player at about 24 frames/sec.
MANY thanks to author for a superb tool and other commentors for their very helpful suggestions.
Per 23 june 2010 comment, I also tried flipping image.
Per 17 Aug 2009 comment I also tried simple binary test images (black X and black blob on white background.
Binary labeling does not match source image in any case.
Was someone able to get proper labeling for an image? If so, what image did you use?
Thanks for upload. Need help with interpreting output to confirm code runs properly.
The code builds and runs fine on R2010b-64 bit system with VisualStudio2008-64. However, Test2.m output produces a binary labeled image of the waterfallf.bmp picture that does not match RGB image. The boundary between labeled regions does not match coastline or any other feature.
What is the correct output for Test2.m ?