资源简介
手势控制音乐播放器 源码
代码片段和文件信息
/**********************************************************************
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二维图形转换为三维图形
相关资源
- 各种CRC校验计算源码
- as3.0小球游戏源码
- WebQQ协议源码
- STM32+MLX90316霍尔传感器驱动源码
- 社工库源码搜云社工库源码
- 逐梦旅程 WINDOWS游戏编程之从零开始
- exynos4412裸机系列教程源码之心跳灯实
- exynos4412裸机系列教程源码之蜂鸣器
- 三个易语言串口通讯源码
-
gsnap.tar.gz linux从fr
amebuffer获取image源 - 平面坐标转换-四参数仿射变换源码
- 可往下钻省市地图源码
- IOS计算器源码
- .net机票预订系统源码
- Ruby中文教程带源码
- TIN三角形网络产生算法源码
- 蓝牙开发教程,部分源码
- flexslider轮播实现源码
- linux压力测试工具stress
- 扫雷源码 IDE=Eclipse
- 国密SM4算法ECB CBC源码及demoLinux C版
- 游戏盾源码.rar
- 美食地图小程序源码
- 微信小程序源码——《出发吧一起》
- 单片机读写fat32 51单片机读写sd卡 51读
- Spring Boot实战 的源码
- element ui table组件使用源码
- LINUX下传输文件源码
- [易语言源码]超人自动打验证码API调用
- FPGA使用SPI口与ARM通信
评论
共有 条评论