MATLAB Help with matlab, structures and movies

AI Thread Summary
The discussion revolves around converting movie frames generated from a 200 by 200 matrix in MATLAB back into their original matrix format for analysis. The user encounters difficulties because the frames are stored as structure files containing cdata, which is a 343x435x3 uint8 array, rather than the expected 200x200 matrix. The confusion arises from the scaling of the original matrix values, where zeros and ones are not translating as anticipated into the cdata format, leading to unexpected values in the output. The user seeks clarification on how to interpret the cdata and convert it back to the original matrix dimensions. Assistance is requested to resolve these issues for further analysis in a second MATLAB program.
Fert
Messages
6
Reaction score
0
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 don't 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
 
Physics news on Phys.org
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.
 
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 don't 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.
 

Similar threads

Replies
4
Views
3K
Replies
1
Views
2K
Replies
2
Views
2K
Replies
4
Views
2K
Replies
1
Views
2K
Back
Top