资源简介
手势控制音乐播放器 源码

代码片段和文件信息
/**********************************************************************
CVobject
Release Date: 2010/12/31
Copyright (C) 2010 Zhijie Lee
email: onezeros.lee@gmail.com
web: http://blog.csdn.net/onezeros
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation either version 3 of the License or
(at your option) any later version.
This program is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not see .
**********************************************************************/
#include “stdafx.h“
#include “CVobject.h“
#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 cvCvtWhite2RGB(IplImage*srcIplImage* dst)
{
assert(src->nChannels==1);
assert(dst->nChannels==3);
assert(dst->width==src->width);
assert(dst->height==src->height);
for (int h=0;hheight;h++){
for (int w=0;wwidth;w++){
unsigned char* p=(unsigned char*)(dst->imageData+h*dst->widthStep+w*3);
if (*(unsigned char*)(src->imageData+h*src->widthStep+w)==255){//white
*p=255;
*(p+1)=255;
*(p+2)=255;
}
}
}
}
static bool _rankTargets(CvTarget t1CvTarget t2)
{
return t1.erea>t2.erea;
}
void cvFindTargets(const IplImage* img_const int erea_thresholdvector&targets)
{
assert(img_->nChannels==1);
targets.clear();
IplImage* img=cvCreateImage(cvSize(img_->widthimg_->height)IPL_DEPTH_8U1);
cvCopy(img_img);
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;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4648 2010-12-12 10:07 KuGouController\KuGouController.vcproj
文件 6365 2011-01-01 08:57 KuGouController\KuGouController.cpp
文件 9641 2011-01-01 08:57 KuGouController\CVob
文件 1231 2010-12-12 09:56 KuGouController\ReadMe.txt
文件 270054 2010-12-16 21:35 KuGouController\region1.bmp
文件 2556 2011-01-01 08:57 KuGouController\CVob
文件 1440 2011-01-01 08:57 KuGouController\stdafx.h
文件 1413 2011-01-01 08:57 KuGouController\KuGouController.vcproj.ONEZEROS.Administrator.user
文件 498 2010-12-12 09:56 KuGouController\targetver.h
文件 220 2010-12-12 09:56 KuGouController\stdafx.cpp
文件 895 2010-12-12 09:56 KuGouController\KuGouController.sln
..A..H. 17408 2011-01-01 08:57 KuGouController\KuGouController.suo
文件 1423 2010-12-27 16:01 KuGouController\KuGouController.vcproj.FOOLPP-REGION.Administrator.user
文件 147968 2010-12-27 15:53 KuGouController\Debug\KuGouController.exe
文件 270054 2010-12-12 10:25 KuGouController\region.bmp
目录 0 2010-12-12 10:07 KuGouController\Debug
目录 0 2010-12-12 09:56 KuGouController
----------- --------- ---------- ----- ----
735814 17
- 上一篇:opencv 多指尖检测 源代码
- 下一篇:opengl二维图形转换为三维图形
相关资源
- Scratch源码
- E4A无障碍跨程序操作类库(带源码、
- 设备管理系统源码
- 安卓wifi直连app源码
- 我的世界源码(易语言版)
- labview编程软件滤波器以及编写程序设
- 我的界面(visual foxpro)源码
- 易语言:一键cf基址源码
- The Secret Path 3D 3D魔方迷宫[源码][scra
- scratch垃圾分类源码(最终版本).sb
- 安卓QQ6.71协议源码易语言,qq协议源码
- 编译原理实验工具及参考源码(lex&
- E盾偷后台工具源码
- UNIX/LINUX编程实践教程的源码
- 十以内加减法练习 powerbuilder源码
- 农场开发项目
- OCR源码
- PLC上位机编程软件
- 用foobar2000听google音乐[更新一下]
- 学生信息管理系统源码
- 用VC 编写的仿QQ聊天室程序源代码
- 毕业论文之温度传感器DS18B20(源码
- 我做的电子琴,21个音,一般歌曲基本
- 可自定义导航网站源码
- 栅栏填充算法源码(VC)
- msp430F149操作红外接收模块源码
- [免费]图像识别c 源码
- 周易排盘源码
- RSA算法源码
- 一个人脸识别程序源码
评论
共有 条评论