To load a movie file on Matlab, we can use the "VideoReader" function which reads video data from an input file. The following code demonstrates how to load a movie file and display the first frame:
main.m139 chars9 lines
To extract the end-diastolic (ED) and end-systolic (ES) frames, we first need to find the frames at which the heart is in ED and ES phase. This can be achieved by analyzing the intensity changes in the frames. We can use the following steps to extract the ED and ES frames:
The following code demonstrates how to extract the ED and ES frames:
main.m717 chars33 lines
In this code, we first load the movie file and read all frames in the "frames" cell array. We then compute the intensity of each frame by converting it to grayscale and taking its mean. We use the "smooth" function in Matlab to smooth the intensity curve and find the maximum and minimum values in it. Finally, we extract the ED and ES frames from the movie file using the frame numbers obtained in step 3 and save them as TIFF files.
gistlibby LogSnag