复杂户型图处理(基于steger算法)—20180710-20180712

(回学校参加夏令营停了一周。。)

光条中心线提取-Steger算法

Steger算法基于Hessian矩阵,能够实现光条中心亚像素精度定位:

首先通过Hessian矩阵能够得到光条的法线方向,然后在法线方向利用泰勒展开得到亚像素位置。 

(乱画的steger代码实现过程。。)

main(){    //StegerTest.cpp
	initLineOpts(opt);    //初始化opt
	/*opt:
	sigma:高斯核执行时的平滑量
	high、low:滞后阈值,用于链接算法
	mode:亮线or暗线被选中
	compute-width:线宽是否提取
	correct-pos:是否应用线宽和位置纠正
	*/
	imread();    //读取图片
	stegerDetectPoints(image, opt, pts){    //StegerDetect.cpp
		medianBlur();
		GaussianBlur();
		detect_lines(){    //position.c  检测线
			convolve_gauss(image, k[i], width, height, sigma, DERIV_R);    //convol.c   _C/_RR/_RC/_CC
			hr = compute_gauss_mask_(&nr, sigma);
			hc = compute_gauss_mask_(&nc, sigma);     //计算高斯平滑核掩膜

			convolve_rows_gauss(image, maskr, nr, h, width, height);
			convolve_cols_gauss(h, maskc, nc, k, width, height);     //用高斯平滑核的倒数卷积图像

			compute_line_points();     //position.c  定位点
			compute_contours();     //link.c  将线点链接到线中
		}
		找到points(根据contours)
	}
	showResult();
}

1、steger效果

      stegerDetectPoints(image, opt, pts);
      //单独显示提取出来的线
	Mat backgroundPoints(rows,cols, CV_8UC1, Scalar(0));
	showResult(backgroundPoints, pts); 
	//叠加在原图上进行显示
	showResult(image, pts);

2、对原图进行canny边缘检测

扫描二维码关注公众号,回复: 2240769 查看本文章

3、找轮廓并校正

4、将提取出的中线与处理后的canny图进行叠加

5、输出中心线周围的点(去除了干扰物体)

6、图像处理,去噪、矢量化、延伸、裁剪、合并重叠的相邻的线段等操作

做不下去了。。并且光条纹中心线提取的结果并不稳定。。

猜你喜欢

转载自blog.csdn.net/qq_42517195/article/details/81087181