Use the opencv and MFC dialog boxes to create a player with Sliding bar Control

Source: Internet
Author: User

(1) Proposal of the question:

Opencv has a simple program for playing video files and loading slide entries. But how can we create a player with Sliding bar control in the MFC dialog box? No code is found on the internet for reference, there are some scammers to link files, which is too much and there is no reference value at all. What should I do?

(2) solutions:

1. Do your research by yourself and don't expect any pie on the Internet, because there are many traps, which are terrible.

2. The key problem to be solved is how the slider control is combined with video playback in Real Time:

① The onhscroll () response function of the main form is responsible for responding to the slider Sliding bar changes, so that the interaction between the slider control and the drag slide action and video playback is easily achieved.

② Create a virtual slider instance and a global variable of the slider's sliding position, and bind the global variable through the data exchange function.

③ Use the cvsetcaptureproperty () function of opencv and the global variable of Slider's sliding position to determine which frame position to point to the video and load the video to the picture control.

(3) solution to the problem:

1. After the program is compiled, the following code is added to the program:

//////////////////////////////////////// //////////////////////////////
// Videoplayer
// Author: Weilin Huang (19894644@qq.com)
// Last modification: May 16,201 2
//////////////////////////////////////// //////////////////////////////

//////////////////////////////////////// //////////////////////////////
// Instructions for use:
// 1. Install vs2008
// 2. Install opencv2.0
// 3. Install cmake2.8.6
// 4. Use cmake to generate the opencv dynamic library that can be called by VC ++ 2008
// 5. Configure the Windows environment variable path and add the bin folder directory after opencv2.0 installation to the user variable
// Make Path =.../bin
// (... Is the full directory path under program files installed in opencv2.0)
// 6. Open VC ++ 2008, and choose tools> Options> project and solution> VC ++ directory from the menu.
// In the directory where the following content is displayed,
// Select the executable file and add it to the directory... \ bin.
// Select the contained file and add it to the directory... \ include \ opencv.
// Select the library file and add it to the directory... \ Lib
// (... Is the full directory path under program files installed in opencv2.0)
// 7. Create an MFC dialog box project videoplayer
// Remove the Unicode Character Set from its attributes and replace the multi-byte set
// Configure the input dependency of the linker cxcore200.lib cv200.lib highgui200.lib
// 8. Or do not perform operations 7, directly overwrite the new videoplayer dialog box project.
// Modify the project configuration attributes in the videoplayer dialog box.
//////////////////////////////////////// //////////////////////////////

//////////////////////////////////////// //////////////////////////////
// Function description:
// 1. Slider control, picture control, OPEN button, play button, pause button, and stop button
// 2. You can load, play, pause, and stop a video, and control the video playback progress through sliding bars.
//////////////////////////////////////// //////////////////////////////

//////////////////////////////////////// //////////////////////////////
// Problems:
// 1. Some videos do not end with multiple frames
// For example, if an AVI video recorded by a video recorder, for example, a frame is recorded, it sometimes loses frames,
// The location where the frame is lost. If the image space of iplimage cannot be used to load the view, an error will be reported during program debugging.
// 2. If all the basic functions are implemented, the execution efficiency is not verified, and whether memory leakage exists.
//////////////////////////////////////// //////////////////////////////

To the following position:

Http://download.csdn.net/detail/huanghanyu11/4311846

Decompress the password to huangweilin.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.