The idea of opening the video is the same as the idea of opening the picture, except that the video is made up of a frame picture, so the handler that opens the video has a sequential process of getting the picture and displaying it frame by piece. GUI with "shallow into shallow out EMGUCV (ii) EMGUCV open the specified image", just as the handler program is programmed as follows:
1 /// <summary>2 ///Click the button to open the specified image3 /// </summary>4 /// <param name= "Sender" ></param>5 /// <param name= "E" ></param>6 Private voidOpenimage_click (Objectsender, EventArgs e)7 {8OpenFileDialog OpenFileDialog =NewOpenFileDialog ();9 if(Openfiledialog.showdialog () = =DialogResult.OK)Ten { One Try A { -Capture =NewCapture (openfiledialog.filename); -fps = (int) capture. Getcaptureproperty (capprop.fps); theApplication.idle + =NewEventHandler (processframe); - } - Catch(Exception exp) - { + MessageBox.Show (exp. Message); - } + A at } - } - Private voidProcessframe (Objectsender, EventArgs e) - { - -Mat frame =capture. Queryframe (); in if(Frame! =NULL) - { to //to make the playback smoother, add the following delay +System.Threading.Thread.Sleep ((int)(1000.0/fps-5)); -Picwindow.image =frame; the * } $ GC. Collect ();Panax Notoginseng}
View Code
Compile run, open video:
Shallow into shallow out EMGUCV (iii) EMGUCV open specified video