From: Bryan Heit on 10 Apr 2010 11:05 I am having a problem converting the output of one of my scripts into an avi video. The function of interest has an output which is a video, structured as a 4-D matrix (Y,X,RGB,f) - by which I mean each frame of the video is a YxX RGB image, and the final dimension is the frames (i.e. if the video was 320x200, each frame would be (200,320,3), and there would be f frames). While this is somewhat of an odd way of handling data, it is the only way to really generate videos given the kind of input data we have. To convert this to a video I used the im2frame command as follows: for i=1:size(OutVid,4) TmpVid(i) = im2frame(OutVid(:,:,:,i)); end I then output this as an avi video using: movie2avi (TmpVid, [char(FileName) '.avi'], 'fps', uint16(FPS), 'compression', 'None'); (note: FPS and FileName are user-set variables within the function) The first step of this process works properly; the individual frames of my matrix convert to frames perfectly. For example: First frame of original matrix, as viewed with imtool(OutVid(:,:,:,1): http://picasaweb.google.ca/bryans.spam.trap/RandomPhotos#5458521337736631314 First frame after conversion to a movie using im2frame, as viewed with movie(TmpVid(1)) http://picasaweb.google.ca/bryans.spam.trap/RandomPhotos#5458524147925628738 However, when I convert this to a movie using the movie2avi command I get a video which is "skewed" upwards and to the right: http://picasaweb.google.ca/bryans.spam.trap/RandomPhotos#5458521338857767586 Every frame of the video is like this. Anyone know what is happening here and how to fix it? Bryan
From: Bryan Heit on 10 Apr 2010 11:07 I forgot to add: I am using Matlab 2009b, 64bit, on a system running ubuntu linux 9.10. I have not tried running the code on any other systems. Thanx again Bryan
From: Bryan Heit on 10 Apr 2010 11:12 Arrrg, links to the pics don't work. First frame of the original matrix: http://picasaweb.google.ca/bryans.spam.trap/ProblemsWithMovie2avi#5458521337736631314 Successful conversion of the first frame of the matrix to a frame: http://picasaweb.google.ca/bryans.spam.trap/ProblemsWithMovie2avi#5458524147925628738 First frame of screwed-up video: http://picasaweb.google.ca/bryans.spam.trap/ProblemsWithMovie2avi#5458521338857767586 Sorry for the confusion! Bryan
|
Pages: 1 Prev: plot3 how to make origin (0,0,0) ? Next: matlab code for sigma filter to remove speackle noise |