Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help with matlab, structures and movies

  1. Mar 14, 2009 #1
    Hi, I made an m-file which which outputs movies at the end. The movie frames are made from images of a 200 by 200 matrix. I wanted to input the movies into a second program which then analyzes each frame. The problem is the frames are structure files and I don't know how to convert the frame back to the 200 by 200 matrix. I've read through the matlab help files on structures but I still don't understand what is in the structure file.

    The files are 1 by 600 structure files. If I take one frame out it is a 1 by 1 structure file which contains cdata which is a <343x435x3 uint8> file and an empty matrix 'colormap'. I dont understand how the cdata file represents a matrix or how to convert cdata back to the original data.

    When looking at parts of the cdata file it contains zeros, ones and 255's, where my original matrix was all zeros and ones.

    In case it matters how I made the movie, this is the code I used:

    in a loop:
    (A is the matrix)
    imagesc(A,'colourmap','gray')
    F(i)=getframe;
    end

    I know the imagesc scales the original matrix but shouldn't zero stay zero and ones get scaled to 255? If so why is there ones in cdata?

    Any help would be greatly appreciated.

    Thank you
     
  2. jcsd
  3. Mar 15, 2009 #2

    MATLABdude

    User Avatar
    Science Advisor

    What does your second program take in? Video files? Image files? MATLAB files? Their own proprietary format? MATLAB's capable of exporting just about anything.
     
  4. Mar 15, 2009 #3
    Thanks for the reply. The second program is another m-file and I wanted to use the movie as the input. The program was supposed to count the number of zeros and ones in each row and average them for each frame. The problem is instead of a 200 by 200 matrix the structure files are 343x435x3. I get why its size mxnx3 because its an 8-bit rgb truecolour image, but I dont understand why its not a 200x200x3. Also I don't understand why the structure file contains zeros ones and 255s. I thought white would be (255,255,255) and black is (0,0,0) so there should be no ones in the cdata file.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Help with matlab, structures and movies
  1. MATLAB: movie (Replies: 2)

  2. MatLab structures (Replies: 5)

Loading...