• 大小: 788KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-27
  • 语言: 其他
  • 标签: opencv  

资源简介

opencv 行游戏手势控制源码。非常有用欢迎下载

资源截图

代码片段和文件信息

#include “CVobject.h“
//Download by http://www.NewXing.com
#include 
#include 
#include 
using namespace std;

void cvThresholdBidirection(IplImage* imgint lowerint upper)
{
assert(img->nChannels==1);
for (int h=0;hheight;h++){
for (int w=0;wwidth;w++){
unsigned char* p =(unsigned char*)(img->imageData+h*img->widthStep+w);
if (*p<=upper&&*p>=lower){
*p=255;
}else{
*p=0;
}
}
}
}

void cvFindTargets(const IplImage* img_const int erea_thresholdCvTarget &targets)
{
assert(img_->nChannels==1);

IplImage* img=cvCreateImage(cvSize(img_->widthimg_->height)IPL_DEPTH_8U1);
cvCopy(img_img);

CvTarget tar;
for (int h=0;hheight;h++){
for (int w=0;wwidth;w++){
if (*(unsigned char*)(img->imageData+h*img->widthStep+w)==255){
CvTarget target;
target.top=h;
target.bottom=h;
target.left=w;
target.right=w;
queue points;
points.push(cvPoint(wh));
*(img->imageData+h*img->widthStep+w)=0;
//find target with breadth iteration
while(!points.empty()){
target.erea++;
CvPoint p=points.front();
points.pop();

if (p.x>0&&*(unsigned char*)(img->imageData+p.y*img->widthStep+p.x-1)==255){//left
*(img->imageData+p.y*img->widthStep+p.x-1)=0;
points.push(cvPoint(p.x-1p.y));
if (target.left>p.x-1){
target.left=p.x-1;
}
}
if (p.y+1height&&*(unsigned char*)(img->imageData+(p.y+1)*img->widthStep+p.x)==255){//bottom
*(img->imageData+(p.y+1)*img->widthStep+p.x)=0;
points.push(cvPoint(p.xp.y+1));
if (target.bottom target.bottom=p.y+1;
}
}
if (p.x+1width&&*(unsigned char*)(img->imageData+p.y*img->widthStep+p.x+1)==255){//right
*(img->imageData+p.y*img->widthStep+p.x+1)=0;
points.push(cvPoint(p.x+1p.y));
if (target.right target.right=p.x+1;
}
}
if (p.y>0&&*(unsigned char*)(img->imageData+(p.y-1)*img->widthStep+p.x)==255){//top
*(img->imageData+(p.y-1)*img->widthStep+p.x)=0;
points.push(cvPoint(p.xp.y-1));
}
}
if (target.erea>erea_threshold){
if (target.erea>tar.erea){
tar=target;
}
}
}
}
}
targets=tar;
cvReleaseImage(&img);
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2401  2011-01-21 19:37  OpenCV 飞行游戏手势控制源码\CVobject.cpp

     文件        762  2011-01-21 19:37  OpenCV 飞行游戏手势控制源码\CVobject.h

     文件       7078  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\BuildLog.htm

     文件     141834  2010-11-30 09:11  OpenCV 飞行游戏手势控制源码\Debug\CVobject.obj

     文件     131075  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\flyControl.obj

     文件      87552  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\flyController.exe

     文件        663  2010-11-30 09:11  OpenCV 飞行游戏手势控制源码\Debug\flyController.exe.embed.manifest

     文件        728  2010-11-30 09:11  OpenCV 飞行游戏手势控制源码\Debug\flyController.exe.embed.manifest.res

     文件        621  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\flyController.exe.intermediate.manifest

     文件     598240  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\flyController.ilk

     文件    1125376  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\flyController.pdb

     文件         64  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\mt.dep

     文件     658432  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\vc90.idb

     文件     569344  2010-11-30 09:12  OpenCV 飞行游戏手势控制源码\Debug\vc90.pdb

     文件       1385  2010-11-28 16:18  OpenCV 飞行游戏手势控制源码\feature\feature-hu-average.txt

     文件       3127  2010-11-28 14:03  OpenCV 飞行游戏手势控制源码\feature\feature-hu-down.txt

     文件       3135  2010-11-28 14:03  OpenCV 飞行游戏手势控制源码\feature\feature-hu-left.txt

     文件       3074  2010-11-28 14:03  OpenCV 飞行游戏手势控制源码\feature\feature-hu-right.txt

     文件       3144  2010-11-28 14:03  OpenCV 飞行游戏手势控制源码\feature\feature-hu-straight.txt

     文件       3085  2010-11-28 14:03  OpenCV 飞行游戏手势控制源码\feature\feature-hu-up.txt

     文件       1385  2010-11-28 16:22  OpenCV 飞行游戏手势控制源码\feature\feature-mesh-average.txt

     文件       9972  2010-11-28 16:22  OpenCV 飞行游戏手势控制源码\feature\feature-mesh-down.txt

     文件       9972  2010-11-28 16:22  OpenCV 飞行游戏手势控制源码\feature\feature-mesh-left.txt

     文件       9972  2010-11-28 16:22  OpenCV 飞行游戏手势控制源码\feature\feature-mesh-right.txt

     文件       9972  2010-11-28 16:22  OpenCV 飞行游戏手势控制源码\feature\feature-mesh-straight.txt

     文件       9972  2010-11-28 16:22  OpenCV 飞行游戏手势控制源码\feature\feature-mesh-up.txt

     文件      16120  2011-01-21 19:37  OpenCV 飞行游戏手势控制源码\flyControl.cpp

     文件        891  2010-11-26 15:32  OpenCV 飞行游戏手势控制源码\flyController.sln

     文件       4060  2010-11-26 16:11  OpenCV 飞行游戏手势控制源码\flyController.vcproj

     文件       1423  2010-12-01 10:06  OpenCV 飞行游戏手势控制源码\flyController.vcproj.FOOLPP-REGION.Administrator.user

............此处省略187个文件信息

评论

共有 条评论