Ejemplo n.º 1
0
Archivo: Videos.cs Proyecto: hornew/REU
        /// <summary>
        /// Open the specified video and get the individual frames.
        /// Construct a 3D Matrix from the 2D matrices returned by the FixFrame function.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        private Matrix[] LoadClip(string path)
        {
            FrameGrabber frames = new FrameGrabber(path);   //grab frames from video at the specified path
            Matrix[] M;                        //Array of 2D matrices built from the frames in the video loaded. Essentially a 3D matrix
            int count = frames.FrameCount;     //number of frames in the video

            Matrix fixedFrame = FixFrame((Bitmap)frames.GetFrame(0)); //fix the first frame. Used for initialization of M

            M = new Matrix[count];

            for (int i = 0; i < count; i++)     //call FixFrame on each frame in the video and fill the matrix with these frames
            {
                fixedFrame = FixFrame((Bitmap)frames.GetFrame(i));
                M[i] = fixedFrame;
            }
            return M;
        }