Canny边缘检测的程序,怎么获取边缘点的坐标,一楼是我的代码
opencv吧
全部回复
仅看楼主
level 9
#include"iostream"
#include "cv.hpp"
#include "cxcore.hpp"
#include "opencv2\highgui\highgui.hpp"
using namespace cv;
using namespace std;
int edgeThresh = 1;
// 声明 原始图片,灰度图片,和 canny边缘图片
Mat image, cedge;
Mat gray, edge;
void onTrackbar(int, void*)
{
//blur 灰度图片
blur(gray, edge, Size(3,3));
// Canny 边缘检测
Canny(gray,edge, edgeThresh, edgeThresh*3, 3);
//全部设为0
cedge = Scalar::all(0);
//拷贝边缘的象素点
image.copyTo(cedge, edge);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
imshow("边缘检测", edge);
}
int main(int argc, char** argv)
{
// 载入图片
image = imread(argv[1], 1);
// 判断载入图片是否成功
if(image.empty())
{
printf("miss the image file: %d \n", argv[1]);
return -1;
}
// 生成灰度图片,因为只有灰度图片才能生成边缘图片
cedge.create(image.size(), image.type());
cvtColor(image,gray, CV_BGR2GRAY);
//新建一个窗口
namedWindow("边缘检测", 1);
// 生成一个进度条来控制边缘检测
createTrackbar("Canny Threshold", "边缘检测", &edgeThresh, 100, onTrackbar);
//初始化图像
onTrackbar(0,0);
waitKey(0);
return 0;
}
2014年11月12日 12点11分 1
level 9
谢谢各位大神了![委屈]
2014年11月12日 12点11分 2
level 9
谢谢各位大神了![委屈]
2014年11月12日 12点11分 3
level 9
谢谢各位大神了![委屈]
2014年11月12日 12点11分 4
level 1
你好 请问这个问题解决了吗
就是说 如何求出canny算子检测到的边缘点的坐标值?请楼主看到了 告诉我下 万分感谢
2015年11月19日 10点11分 6
我没求出来。。。用其他方法解决了
2015年11月19日 10点11分
@花样年华__y 请问具体怎么求canny检测到的边缘点的坐标值?能把代码写一下吗?真的感激不尽,谢谢!
2015年11月20日 02点11分
@joemin92 扫码检测后的像素点,我这么做的,肯定有简单办法,我是找不到了。你试试
2015年11月25日 00点11分
level 8
....边缘检测完就完啦???
不是边缘检测完后配合轮廓寻找么。
2015年11月23日 09点11分 7
没有,后来挨个像素点找的
2015年11月25日 00点11分
怎么一个像素一个像素的找???
2016年10月07日 01点10分
@这份情丶待续 我是扫描像素点的数值,黑点和白点是不一样的,然后存到数组里,比较麻烦的方法,当时做比赛没办法时间急,实现功能就行,效率不高
2016年10月10日 02点10分
@这份情丶待续 比如白点黑点的像素值分别是(255,255,255)(0,0,0)通过一个判断就能找出来
2016年10月10日 02点10分
level 3
要不你一个像素一个像素的找呗
2015年11月24日 15点11分 8
就这么做的
2015年11月25日 00点11分
level 6
边缘检测得到的是图像,轮廓提取得到的是轮廓点的坐标。
2016年10月17日 06点10分 10
[真棒]
2016年10月19日 01点10分
1