说明:代码需要用蓝色为触发点,当视场中蓝色部分大于一定程度后,开启线程调用音频和视频
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include<windows.h>
#include <mmsystem.h>
#include<dsound.h>
#include <thread>
#pragma comment(lib, "WINMM.LIB")
using namespace cv;
using namespace std;
int mp4()
{
VideoCapture cap(0); //capture the video from web cam
if (!cap.isOpened()) // if not success, exit program
{
cout << "Cannot open the web cam" << endl;
return 0 ;
}
namedWindow("Control", WINDOW_AUTOSIZE); //create a window called "Control"
int iLowH = 100;
int iHighH = 140;
int iLowS = 90;
int iHighS = 255;
int iLowV = 90;
int iHighV = 255;
//Create trackbars in "Control" window
createTrackbar("LowH", "C