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