visualc++meanshift算法

visualc++meanshift算法

ID:22023242

大小:17.51 KB

页数:10页

时间:2018-10-26

visualc++meanshift算法_第1页
visualc++meanshift算法_第2页
visualc++meanshift算法_第3页
visualc++meanshift算法_第4页
visualc++meanshift算法_第5页
资源描述:

《visualc++meanshift算法》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、VisualC++:MeanShift算法2010/10/2216:51说明:1.Meanshift.h中包含一个图像类CImage,这个可能每个人用的图像类都不一样,要根据你自己的图像类做相应的修改。2.分割时,是把不同区域的均值做为该区域的全部像素的值。这一点可以在程序中看到。3.窗宽的选择很重要,请根据实际情况自己选择。4.为了节约运算时间,算法的迭代过程只进行了一次。5.该类在VS2005VisualC++.net下测试通过。//Meanshift.h:interfacefortheCMeanshiftclass.///////////////

2、/////////////////////////////////////////////////////////#if!defined(AFX_MEANSHIFT_H__E6E877AA_4E4D_42A7_BE5F_7A021E6311E9__INCLUDED_)#defineAFX_MEANSHIFT_H__E6E877AA_4E4D_42A7_BE5F_7A021E6311E9__INCLUDED_#if_MSC_VER>1000#pragmaonce#endif//_MSC_VER>1000#include"Image.h"classCMea

3、nshift{public:doublecomputeweigth(CImage&ori_img,inti,intj,intx,inty,unsignedcharcurrentvalue);unsignedcharMSsmooth(CImage&ori_img,intx,inty);CMeanshift();CMeanshift(intspatial_kwidth,intrange_kwidth,charkind);virtual~CMeanshift();BOOLmeanshiftsmooth(CImage&ori_img,CImage&out_im

4、g);BOOLinitmeanshift(charkind);BOOLmeanshiftseg(CImage&image,intnthreshold);//对经过平滑之后的图像进行分割private:double*m_pspatial_weigth;double*m_prange_weigth;charm_ckind;//thetypeofthekernelfunction;either'guass"or"flat"intm_ispatial_kwidth;//spatialkernalwidthintm_irange_kwidth;//rangeke

5、rnalwidth};#endif//!defined(AFX_MEANSHIFT_H__E6E877AA_4E4D_42A7_BE5F_7A021E6311E9__INCLUDED_)//Meanshift.cpp:implementationoftheCMeanshiftclass.////////////////////////////////////////////////////////////////////////#include"stdafx.h"#include"Meanshift.h"#ifdef_DEBUG#undefTHIS_F

6、ILEstaticcharTHIS_FILE[]=__FILE__;#definenewDEBUG_NEW#endif////////////////////////////////////////////////////////////////////////Construction/Destruction//////////////////////////////////////////////////////////////////////CMeanshift::CMeanshift(){}CMeanshift::CMeanshift(intsp

7、atial_kwidth,intrange_kwidth,charkind){m_ispatial_kwidth=spatial_kwidth;m_irange_kwidth=range_kwidth;m_ckind=kind;}CMeanshift::~CMeanshift(){}BOOLCMeanshift::meanshiftsmooth(CImage&ori_img,CImage&out_img){inti,j;intimg_width=ori_img.GetWidth();intimg_height=ori_img.GetHeigth();i

8、f(!initmeanshift(m_ckind)){  returnFALSE;}if(!o

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。