91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

使用OpenNI類庫實現。在Kinect的支持下,通過對手勢的識別和跟蹤,來代替鼠標移動和點擊。該程序使人能夠徒手控制PC,如用Firefox瀏覽網頁,玩水果忍者等等。此程序為非MFC版本。開發教程:http://blog.csdn.net/chenxin_130/article/details/6693390

資源截圖

代碼片段和文件信息

/*************************************
Kinect?Skeleton
Author:?Xin?Chen?2011
Blog:http://blog.csdn.net/chenxin_130
**************************************/
#include?“AppMessage.h“
#include?

/*
#pragma?comment?(lib“user32“)
*/

//Location?and?move?angle?last?time?for?each?userId(Hand?Id)
CvPoint?lastLocation[MAX_HAND_NUM];

int?isHandTracking[MAX_HAND_NUM]={0};
int?isClickDown=0;

void?addTrackingId(int?userId)
{
isHandTracking[userId]=1;
}

void?removeTrackingId(int?userId)
{
isHandTracking[userId]=0;
}

CvPoint?getLastLocation(int?userId)
{
return?lastLocation[userId];
}

void?messageHandler(CvPoint?&location?int?userIdint?flag)
{
//initialize?the?lastLocation?from?the?location?obtained?by?the?first?time
if(lastLocation[userId].x==0&&lastLocation[userId].y==0)
{
lastLocation[userId].x=location.x;
lastLocation[userId].y=location.y;
}
if(flag==REAL_MOUSE_CLICK)
{
if(!isClickDown)
{
mouse_event(MOUSEEVENTF_LEFTDOWN0000);
}
else?{
mouse_event(MOUSEEVENTF_LEFTUP0000);
}
isClickDown=1-isClickDown;
}
else?if(flag==REAL_MOUSE_MOVE)
{
int?firstHandId=-1;
for(int?i=0;i {
if(isHandTracking[i]!=0)
{
if(firstHandId==-1)
{
firstHandId=i;
break;
}
}
}
if(abs(location.x-lastLocation[userId].x)<5)
{
location.x=lastLocation[userId].x;
}
if(abs(location.y-lastLocation[userId].y)<5)
{
location.y=lastLocation[userId].y;
}

if(userId==firstHandId)
{
//mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE
//(location.x-320)*65536/640*2location.y*65536/480*200);
mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE
(location.x-160)*65536/640*2(location.y-120)*65536/480*200);
}
}
lastLocation[userId].x=location.x;
lastLocation[userId].y=location.y;

}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-10-20?22:47??KinectMouseControl\
?????目錄???????????0??2011-10-20?22:48??KinectMouseControl\KinectMouseControl\
?????文件????????1945??2011-10-20?22:44??KinectMouseControl\KinectMouseControl\AppMessage.cpp
?????文件?????????443??2011-10-20?22:41??KinectMouseControl\KinectMouseControl\AppMessage.h
?????文件?????????219??2011-10-20?22:41??KinectMouseControl\KinectMouseControl\KinectGesture.h
?????文件????????6242??2011-10-20?22:44??KinectMouseControl\KinectMouseControl\KinectGestureMain.cpp
?????文件????????4166??2011-10-19?20:32??KinectMouseControl\KinectMouseControl\KinectMouseControl.vcproj
?????文件?????????920??2011-10-19?20:26??KinectMouseControl\KinectMouseControl.sln
?????文件???????16896??2011-10-20?22:47??KinectMouseControl\KinectMouseControl.suo
?????目錄???????????0??2011-10-20?22:48??KinectMouseControl\Release\
?????文件???????17920??2011-10-20?22:44??KinectMouseControl\Release\KinectMouseControl.exe

評論

共有 條評論