opencv: partition应用
来源:互联网 发布:傲剑境界数据 编辑:程序博客网 时间:2024/05/22 05:18
//距离小于10的点归为一类
bool _EqPredicate(const Point& a, const Point& b)
{return ((b.y-a.y)*(b.y-a.y)+(b.x-a.x)*(b.x-a.x)<10*10);
}
void ClusteringPartition()
{
Mat img(500, 500, CV_8UC3);
RNG rng(12345);
vector<Point> points;
vector<int> labels;
int sampleCount=6;
points.push_back(Point(200,200));
points.push_back(Point(200,215));
points.push_back(Point(205,200));
points.push_back(Point(400,200));
points.push_back(Point(400,205));
points.push_back(Point(405,200));
randShuffle(points, 1, &rng);
long count=partition(points, labels,_EqPredicate);
OutInfo("count",count);
img = Scalar::all(0);
for( int i = 0; i < sampleCount; i++ )
{
Point ipt = points.at(i);
circle( img, ipt, 2, CV_RGB(255,255,255), 1, LINE_AA );
}
imshow("points", img);
img = Scalar::all(0);
for( int i = 0; i < sampleCount; i++ )
{
int Idx = labels.at(i)+1;
Point ipt = points.at(i);
circle( img, ipt, 2, CV_RGB(Idx*100%255,0,0), FILLED, LINE_AA );
}
imshow("partition", img);
}
0 0
- opencv: partition应用
- OpenCV partition
- Opencv聚类函数 partition()
- partition算法思想的应用
- (OpenCV)函数cv::partition解析
- SQLServer 中partition by的应用场景
- hadoop中partition的简单应用《转》
- Partition
- PARTITION
- partition
- partition
- partition
- Partition
- partition
- partition
- OpenCV应用笔记
- OpenCV应用----BOW篇
- OpenCV应用----BOW篇
- 调用rest地址时异常:Invalid use of BasicClientConnManager: connection still allocated.
- unity基础开发--鼠标移动物体并判断是否移动
- 网络间json字符串传递的技巧
- typedef和#define的用法与区别
- Ubuntu 14.04 安装搜狗输入法
- opencv: partition应用
- STL中map用法详解
- CentOS下如何安装libevent
- 编译出错:file is universal (4 slices) but does not contain a(n) armv7s slice
- codeforces 225C Barcode (dp)
- SVN上传临时目录导致svn钩子出错提示解决
- JS多级联动下拉列表(不限级数)
- JS获取GET请求中QueryString中的参数
- Linux命令学习:alias