資源簡介
一個實現石頭剪刀布的小程序,基于opencv,在vs2010和opencv2.4.4下可以完美運行,另一個是一個根據手勢播放音頻的,還有一個提供參考
代碼片段和文件信息
#include?“stdafx.h“
//#include?“cv.h“
#include?
#include?
//#include?
//#include???
#include?
using?namespace?std;
int?pmsf_value?=?5;//均值飄逸分割平滑系數
int?MopEx_value?=?2;//開運算
int?Hmatch_value?=?25;//模板匹配系數
//亮度
int?V_low?=?30;
int?V_high?=?250;
//飽和度
int?S_low?=?10;
int?S_high?=?170;
//色相
int?H_low_max?=?40;
int?H_high_min?=?100;
int?if_high_light?=?1;?//是否高光補償
IplImage?*src?=?0;
IplImage?*srcResize?=?0;
IplImage?*img_YCrCb?=?0;
CvSize?newSize;
CvSize?sz;
IplImage?*tmp1;?
IplImage?*tmp2;?
IplImage?*tmp3;?
IplImage?*src2;?
IplImage?*src1;?
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
IplImage?*YCrCb;
IplImage?*YCrCb_mask;
IplImage?*Y_channel*Cr_channel?*Cb_channel;
IplImage?*Y_cmp*Cr_cmp?*Cb_cmp;
CvScalar?Y_lower;
CvScalar?Y_upper;
CvScalar?Cr_lower;
CvScalar?Cr_upper;
CvScalar?Cb_lower;
CvScalar?Cb_upper;
CvScalar?YCrCb_lower;
CvScalar?YCrCb_upper;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
void?init_hand_YCrCb()
{
//
img_YCrCb?=?cvCreateImage(?sz?8?3);
YCrCb_mask?=?cvCreateImage(szIPL_DEPTH_8U1);;
//最終的圖片
YCrCb?=?cvCreateImage(szIPL_DEPTH_8U3);
//三通道
Y_channel?=?cvCreateImage(szIPL_DEPTH_8U1);
Cr_channel?=?cvCreateImage(szIPL_DEPTH_8U1);
Cb_channel?=?cvCreateImage(szIPL_DEPTH_8U1);?
//按范圍截取后
Y_cmp?=?cvCreateImage(szIPL_DEPTH_8U1);
Cr_cmp?=?cvCreateImage(szIPL_DEPTH_8U1);
Cb_cmp?=?cvCreateImage(szIPL_DEPTH_8U1);
//YCrCb的顏色范圍
Y_lower?=?CV_RGB(00130);
Y_upper?=?CV_RGB(00130);
Cr_lower?=?CV_RGB(00125);
Cr_upper?=?CV_RGB(00125);
Cb_lower?=?CV_RGB(00132);
Cb_upper?=?CV_RGB(00147);
YCrCb_lower?=?cvScalar(001320);
YCrCb_upper?=?cvScalar(1301251470);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void?hand_YCrCb()
{
//轉換到YCrBr
cvCvtColor(src2img_YCrCb?CV_RGB2YCrCb);
//分割到YCrCb
cvSplit(img_YCrCbY_channelCr_channelCb_channel0);
//將Y_channel的位于?Y_lower?和?Y_upper?之間的元素復制到?Y_tmp中
cvInRangeS(?Y_channel?Y_lower?Y_upper?Y_cmp);?
cvInRangeS(Cr_channelCr_lowerCr_upper?Cr_cmp);
cvInRangeS(Cb_channelCb_lowerCb_upper?Cb_cmp);
//合并YCrCb通道到YCrCb中
cvMerge(Y_cmpCr_cmpCb_cmp0YCrCb);
//顯示結果
cvShowImage(“YCrCb_mask“YCrCb);
//cvInRangeS?(img_YCrCb?YCrCb_lower?YCrCb_upper?YCrCb_mask);
//cvShowImage(?“YCrCb_mask“?YCrCb_mask);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
IplImage*?hsv_image;
IplImage*?hsv_mask;
CvScalar??hsv_min;
CvScalar??hsv_max;
IplImage?*H_img*S_img?*V_img;
IplImage?*H_mask?*H_mask1*S_mask?*S_mask1?*V_mask?*V_mask1?*V_mask2;
//////////////////////////////////
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????135235??2004-03-11?21:53??2==862\手識識別\Debug\MusicPlay.exe
?????文件????????246??2004-03-11?21:39??2==862\手識識別\MusicPlay.clw
?????文件??????40061??2004-03-11?22:04??2==862\手識識別\MusicPlay.cpp
?????文件???????4322??2004-03-11?21:39??2==862\手識識別\MusicPlay.dsp
?????文件????????543??2004-03-11?21:39??2==862\手識識別\MusicPlay.dsw
?????文件????????335??2004-03-11?21:39??2==862\手識識別\MusicPlay.h
?????文件??????41984??2004-03-11?22:04??2==862\手識識別\MusicPlay.ncb
?????文件??????53760??2004-03-11?22:04??2==862\手識識別\MusicPlay.opt
?????文件???????2391??2004-03-11?21:53??2==862\手識識別\MusicPlay.plg
?????文件???????1457??2004-03-11?21:39??2==862\手識識別\MusicPlay.rc
?????文件???????1626??2004-03-11?21:39??2==862\手識識別\ReadMe.txt
?????文件????????450??2004-03-11?21:39??2==862\手識識別\Resource.h
?????文件????????296??2004-03-11?21:39??2==862\手識識別\StdAfx.cpp
?????文件???????1106??2004-03-11?21:39??2==862\手識識別\StdAfx.h
?????文件?????250368??2010-05-21?14:05??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\1?軟件需求分析與開發計劃.doc
?????文件?????138752??2010-05-21?16:39??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\2概要設計說明書.doc
?????文件??????57856??2010-05-21?16:08??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\3?數據需求說明書.doc
?????文件?????200192??2010-05-21?16:24??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\4?詳細設計說明書.doc
?????文件?????181248??2010-05-21?16:31??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\5?測試分析報告.doc
?????文件?????777216??2010-05-21?14:05??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\6?使用說明書.doc
?????文件??????84992??2010-05-21?16:01??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\7?項目開發總結報告.doc
?????文件?????700928??2010-05-21?16:23??26openCVshoushishibie\基于openCV的手勢識別\開發文檔\項目技術論文.doc
?????文件???????5950??2010-04-06?14:48??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\1.bmp
?????文件???????2822??2010-04-06?20:25??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\10.bmp
?????文件???????5326??2010-04-06?14:46??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\2.bmp
?????文件???????4990??2010-04-06?14:49??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\3.bmp
?????文件???????6758??2010-04-06?20:19??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\4.bmp
?????文件???????5886??2010-04-06?14:51??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\5.bmp
?????文件???????4574??2010-04-06?20:21??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\6.bmp
?????文件???????4878??2010-04-06?20:23??26openCVshoushishibie\基于openCV的手勢識別\成果軟件\7.bmp
............此處省略154個文件信息
評論
共有 條評論