Use OPENCV players to create a video control (no sound)

Source: Internet
Author: User

Description: OpenCV Computer Vision Library, so use image or video processing, so that there is no sound in playing video temporarily

Software: Use OpenCV player (no sound)

Feature Description: Creates a new playback form. Join the progress bar to drag the video playback.

Flow chart:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvd3f0agfoyq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

Function Description:

1. New Progress bar Cvcreattrackbar ("", "", &,frames,callback)

2, get total frame number Cvgetcaptureproperty (&,id)

Double Cvgetcaptureproperty (cvcapture* capture, int property_id); capture video capture structure. the property_id property identity. Can be one of the following:Cv_cap_prop_frame_count-The total number of frames in a video file

3. Callback function Cvset (&. ID, POS)

int Cvsetcaptureproperty (cvcapture* capture, int property_id, double value) The identifier for the property_id property. Can be one of the following:cv_cap_prop_pos_frames-Unit is the position of the frame number (only valid for video files)

Source:

#include "cv.h" #include "highgui.h" int g_slider_position=0; cvcapture* g_capture =null;void cvtrackcalllback (int pos) {  cvsetcaptureproperty (g_capture, Cv_cap_prop_pos_ FRAMES, POS);} int main (int argc, char** argv) {Cvnamedwindow ("Example3", cv_window_autosize); g_capture = cvcreatefilecapture ("Video Path") ; int frames = (int) cvgetcaptureproperty (g_capture,cv_cap_prop_frame_count);  if (frames!=0)    {     Cvcreatetrackbar ("Test", "Example3", &g_slider_position,frames,cvtrackcalllback);    }  iplimage* Frame;while (1) {frame = Cvqueryframe (g_capture) cvshowimage ("Example3", frame);  Cvwaitkey (0);} return 0;}

The execution structure is as follows:

Have a problem, willing to communicate with you!







Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Use OPENCV players to create a video control (no sound)

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.