Opencv cvPyrSegmentation函数
来源:互联网 发布:网络推广与seo 编辑:程序博客网 时间:2024/06/07 00:56
/* Splits color or grayscale image into multiple connected components
of nearly the same color/brightness using modification of Burt algorithm.
comp with contain a pointer to sequence (CvSeq)
of connected components (CvConnectedComp) */
/*
CVAPI(void) cvPyrSegmentation( IplImage* src, IplImage* dst,
CvMemStorage* storage, CvSeq** comp,
int level, double threshold1,
double threshold2 );
src
输入图像.
dst
输出图像.
storage
Storage: 存储连通部件的序列结果
comp
分割部件的输出序列指针 components.
level
建立金字塔的最大层数
threshold1
建立连接的错误阈值
threshold2
分割簇的错误阈值
函数 cvPyrSegmentation 实现了金字塔方法的图像分割。金字塔建立到 level 指定的最大层数。如果 p(c(a),c(b))<threshold1,则在层 i 的象素点 a 和它的相邻层的父亲象素 b 之间的连接被建立起来,
定义好连接部件后,它们被加入到某些簇中。如果p(c(A),c(B))<threshold2,则任何两个分割 A 和 B 属于同一簇。
如果输入图像只有一个通道,那么
p(c1,c2)=|c1-c2|.
如果输入图像有单个通道(红、绿、兰),那幺
p(c1,c2)=0,3·(c1r-c2r)+0,59·(c1g-c2g)+0,11·(c1b-c2b) .
每一个簇可以有多个连接部件。图像 src 和 dst 应该是 8-比特、单通道 或 3-通道图像,且大小一样
*/
#include "stdafx.h"#include <cv.h>#include <highgui.h>#include <iostream>using namespace std;void doPyrSegmentation( IplImage * src ,IplImage * dst ){assert(src->width%2 == 0 && src->height%2 == 0);CvMemStorage * stoage = cvCreateMemStorage(0) ;CvSeq* comp=NULL;int level = 3 ; //进行n层采样double threshold1 = 150 ;double threshold2 = 30 ;cvPyrSegmentation(src,dst, stoage,&comp,level, threshold1,threshold2) ;}; int main(int argc,char ** argv){ IplImage* src = NULL; IplImage* dst = NULL; src = cvLoadImage("C:\\Users\\Administrator\\Desktop\\1002.png"); dst=cvCreateImage(cvGetSize(src), src->depth,src->nChannels);doPyrSegmentation(src,dst);cvNamedWindow("src") ;cvNamedWindow("dst") ;cvShowImage("src",src);cvShowImage("dst",dst);cvWaitKey(0) ;cvDestroyAllWindows();return 0;}
- Opencv cvPyrSegmentation函数
- opencv——cvPyrSegmentation
- opencv 金字塔图像分割cvPyrSegmentation
- OpenCV学习:cvPyrSegmentation金字塔分割算法
- opencv用金字塔cvPyrSegmentation实现图像分割
- OpenCV编译提示:error: C3861: “cvPyrSegmentation”: 找不到标识符
- opencv学习笔记(十七)利用cvPyrSegmentation()做图像分割
- 【OpenCV】arm-linux-gcc 3.4.1 移植OpenCV 1.0 出现[cvpyrsegmentation.lo] Error 1 错误
- cvPyrSegmentation() 图像金字塔分割
- OpenCV函数
- opencv 函数
- OpenCV 函数
- opencv函数
- 【OpenCV】OpenCV的fillPoly函数
- cvPyrSegmentation 高斯图像金字塔做分割
- openCV cvEigenVV函数
- openCV基础函数【转】
- OpenCv视频处理函数
- 医药吧网API接口开放
- Hadoop基本操作命令
- bash数据手册
- myeclipes8.5中java.lang.OutOfMemoryError: Java heap space的问题
- 无法定位程序输入点sqlite3_wal_checkpoint于动态链接库SQLite3.dll
- Opencv cvPyrSegmentation函数
- Qt 的一些心得(背景设置,圆角,半透明)
- 《jQuery技术内幕:深入解析jQuery架构设计与实现原理》
- Oracle数字函数
- Android AsyncTask
- C#中调整代码格式
- 设计模式
- 提高程序运行速度 让Ext JS华而又实
- ssh连接时认证时间过长解决方法