OpenCV playing video

Source: Internet
Author: User
Tags visual studio 2010

Console app for new QT

The. Pro directory is set up as follows//QT configuration OPENCV procedure See http://blog.csdn.net/bladeandmaster88/article/details/51591579

#-------------------------------------------------
#
# Project created by Qtcreator 2016-06-08t22:26:44
#
#-------------------------------------------------
QT       + + core
QT-       = GUI
TARGET = PlayVideo
CONFIG   + = Console
CONFIG-   = App_bundle
TEMPLATE = App
SOURCES + = Main.cpp
Includepath + = D:\opencv\include\
Includepath + = d:\opencv\include\opencv\
Includepath + = D:\opencv\include\opencv2\
libs+= d:\OpenCV\lib\libopencv_core249.dll.a\
D:\OpenCV\lib\libopencv_highgui249.dll.a\

Main.cpp



--------------------------------------"Program description"-------------------------------------------
Program Description: "Introduction to OpenCV3 Programming" OpenCV2 Edition book matching example program 06
Program Description: Use the Videocapture class for video reading and playback
Operating system for development testing: Windows 7 64bit
Developing the IDE version for testing: Visual Studio 2010
Development Test OPENCV version: 2.4.9
March 2014 Created by @ Light Ink _ Mao Nebula
November 2014 revised by @ Light Ink _ Mao Nebula
//------------------------------------------------------------------------------------------------




---------------------------------"header file, namespace contains part"----------------------------
Description: Contains the header files and namespaces used by the program
//-------------------------------------------------------------------------------------------------
#include <opencv2\opencv.hpp>
using namespace CV;


#include <QDebug>


int main ()
{
"1" read in video
Videocapture Capture ("1.avi");


if (!capture.isopened ())
Qdebug () << "Faile to open!";


"2" cycle shows each frame
while (1)
{
Mat frame;//defines a mat variable that stores images for each frame
capture>>frame; Read Current frame
if (!frame.empty ())
Imshow ("Reading video", frame); Show Current frame
Waitkey (30); Delay 30ms
}
return 0;
}

Several problems of attention

1. My code is "Getting Started with OpenCV3 programming."

2. You need to place 1.avi files in the Debug directory,

3. Just start capture old tips open failed, online said download VirtualDub and XviD encoder, but all not work, in fact, only need to download ffdshow decoder, pro-test available.

Ffdshow decoder for the http://sourceforge.net/projects/ffdshow-tryout, installation, must choose "VFW interface" and "VirtualDub", installed on the line.

4.imshow ("Reading video", frame),//The code in the book the first parameter is Chinese, I changed to English, otherwise, the window is small, and does not show the image.

http://blog.csdn.net/bladeandmaster88/article/details/51628659

OpenCV playing video

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.