To load a movie file in Matlab, we can use the VideoReader
function. Here's an example:
main.m40 chars2 lines
This creates a VideoReader
object that we can use to read frames from the movie file. To extract the end-diastolic (ED) and end-systolic (ES) frames, we need to do the following:
Here's the code for this:
main.m707 chars32 lines
This code reads each frame of the movie, computes the average intensity of the frame, and checks if it is the maximum or minimum average intensity seen so far. If it is, it saves the corresponding frame as the ED or ES frame. Finally, it saves the ED and ES frames to separate image files (in PNG format).
gistlibby LogSnag