首页 > 代码库 > cvThreshold与cvAdaptiveThreshold 阀值化操作与自动阀值化操作
cvThreshold与cvAdaptiveThreshold 阀值化操作与自动阀值化操作
核心函数:cvThreshold,cvAdaptiveThreshold
程序:
代码:
#include "cv.h" #include "cxcore.h" #include "highgui.h" #include <iostream> int AdaptiveThreshold(int argc,char** argv) { IplImage* src=http://www.mamicode.com/cvLoadImage("e:\\picture\\4.jpg",0); IplImage* dst1=cvCreateImage(cvGetSize(src),src->depth,1); IplImage* dst2=cvCreateImage(cvGetSize(src),src->depth,1); cvThreshold(src,dst1,125,255,CV_THRESH_BINARY); //估计阀值 cvAdaptiveThreshold(src,dst2,255,CV_ADAPTIVE_THRESH_GAUSSIAN_C,CV_THRESH_BINARY); //手动阀值 cvNamedWindow("src"); cvNamedWindow("threshold"); cvNamedWindow("AdaptiveThreshold"); cvShowImage("src",src); cvShowImage("threshold",dst1); cvShowImage("AdaptiveThreshold",dst2); cvWaitKey(0); cvDestroyWindow("src"); cvDestroyWindow("threshold"); cvDestroyWindow("AdaptiveThreshold"); cvReleaseImage(&src); cvReleaseImage(&dst1); cvReleaseImage(&dst2); return 0; }
本文出自 “flyclc” 博客,请务必保留此出处http://flyclc.blog.51cto.com/1385758/1539854
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。