• 大小: 17.01MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-26
  • 语言: 其他
  • 标签: OpenCV  

资源简介

OPENCV动作识别--挥拳动作识别,OpenCV3.0版本,VS2012完美运行。

资源截图

代码片段和文件信息

 
#include “afx.h“ 
#include    // for standard I/O  
#include    // for strings  
#include   // for controlling float print precision  
#include   // string to number conversion  
#include  
#include “cv.h“    
#include “highgui.h“    
#include “cxcore.h“  
#include   // Gaussian Blur  
#include         // Basic OpenCV structures (cv::Mat Scalar)  
#include   // OpenCV window I/O  
#include“opencv2/opencv.hpp“
using namespace cv;  
using namespace std;  

int main(int arg const char** argv) 
{  
    int delay = 1;  
    char c;  
    int frameNum = -1;          // frame counter  
    bool lastImgHasHand=false;  
  
    int previousX=0;  
    int previousY=0;  
int pt=0;//显示help判断用
    // CvCapture* pCapture = NULL;//  /////////////////////////////////////////////////////////////////
    // pCapture = cvCaptureFromCAM(-1);  //////////////////////////////////////////////////////////////
  
    //Size refS = Size( (int) captRefrnc.get(CV_CAP_PROP_frame_WIDTH)  
    //  (int) captRefrnc.get(CV_CAP_PROP_frame_HEIGHT) );  
  
    bool bHandFlag = false;  
  
    //const char* WIN_SRC = “Source“;  
    const char* WIN_RESULT = “Result“;  
  
    // Windows  
    //namedWindow(WIN_SRC CV_WINDOW_AUTOSIZE );  
    namedWindow(WIN_RESULT CV_WINDOW_AUTOSIZE);  
  

    Mat frame;  // 输入视频帧序列  
    Mat frameHSV;   // hsv空间  
    Mat mask(frame.rows frame.cols CV_8UC1);  // 2值掩膜  
    Mat dst(frame); // 输出图像  
  
//  Mat frameSplit[4];  
  
    vector< vector > contours;   // 轮廓  
    vector< vector > filterContours; // 筛选后的轮廓  
    vector< Vec4i > hierarchy;    // 轮廓的结构信息  
    vector< Point > hull; // 凸包络的点集  
  
    bool movement=false;   
    int count=0;  
      
    int presentX=0;  
    int presentY=0;  
VideoCapture capture; ////////////////////////////////////////////////////////
capture.open(0);///////////////////////////////////////////////////
if(!capture.isOpened())
{
return 0;
}/////////////////////////////////////////////////////////////////////////////////
    while(true) //Show the image captured in the window and repeat  
    {  
        //captRefrnc >> frame;  
    int minX=320;//屏幕的一半  
    int maxX=240;  
    int minY=320;  
    int maxY=240;  
capture >> frame;//////////////////////////////////////////////////////////////
       
        if( frame.empty())  
        {  
            cout << “ < < <  Game over!  > > > “<< endl;  
            break; 
        }  

        //imshow( WIN_SRC frame);//显示Source的图像  
Mat ws=frame.clone();//////////////////////////////////////////////////////////////////
  
        // Begin  
  
        // 中值滤波,去除椒盐噪声  
        medianBlur(frame frame 5);  
        cvtColor( frame frameHSV CV_BGR2HSV );  
  
        Mat dstTemp1(frame.rows frame.cols CV_8UC1);  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-16 14:35  test1\
     目录           0  2018-05-14 15:50  test1\Debug\
     文件      122880  2018-05-14 15:50  test1\Debug\test1.exe
     文件      644000  2018-05-14 15:50  test1\Debug\test1.ilk
     文件     3402752  2018-05-14 15:50  test1\Debug\test1.pdb
     目录           0  2018-04-08 13:14  test1\test1\
     目录           0  2018-05-14 15:50  test1\test1\Debug\
     文件       43710  2018-05-14 15:50  test1\test1\Debug\CL.read.1.tlog
     文件         280  2018-05-14 15:50  test1\test1\Debug\CL.write.1.tlog
     文件         596  2018-05-14 15:50  test1\test1\Debug\cl.command.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link-cvtres.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link-cvtres.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link-mt.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link-mt.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link-rc.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link-rc.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800-cvtres.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800-cvtres.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800-mt.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800-mt.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800-rc.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800-rc.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.2800.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.5496-cvtres.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.5496-cvtres.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.5496-mt.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.5496-mt.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.5496-rc.read.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.5496-rc.write.1.tlog
     文件           2  2018-05-14 15:50  test1\test1\Debug\link.5496.read.1.tlog
............此处省略24个文件信息

评论

共有 条评论