Rel*_*lla 7 algorithm image-processing haar-wavelet straight-line-detection
所以我有一个像这样的图像:

我想得到这样的东西(我没有绘制我想要的所有行,但我希望你能得到我的想法):

我想使用SURF((Speeded Up Robust Features)是一个强大的图像描述符,首先由Herbert Bay等人在2006年提出)或基于2D Haar小波响应之和的东西,并有效地使用积分图像找到图像上的所有直线.我想得到相对于图片像素坐标线的起点和终点.
所以在这张照片上找到瓷砖和顶部的那两条黑线之间的所有线条.
是否有任何此类代码示例(具有行搜索功能)从哪个开始?
我喜欢C和C++,但任何其他可读的代码都可能适用于我=)
下面是应用霍夫变换检测线条的完整示例。我正在使用 MATLAB 来完成这项工作。
诀窍是将图像划分为多个区域并对每个区域进行不同的处理;这是因为您的场景中有不同的“纹理”(墙壁上部区域的瓷砖与底部较暗的瓷砖有很大不同,并且一次处理所有图像并不是最佳的)。
作为一个工作示例,请考虑以下示例:
%# load image, blur it, then find edges
I0 = rgb2gray( imread('http://www.de-viz.ru/catalog/new2/Holm/hvannaya.jpg') );
I = imcrop(I0, [577 156 220 292]); %# select a region of interest
I = imfilter(I, fspecial('gaussian', [7 7], 1), 'symmetric');
BW = edge(I, 'canny');
%# Hough Transform and show accumulated matrix
[H T R] = hough(BW, 'RhoResolution',2, 'Theta',-90:0.5:89.5);
imshow(imadjust(mat2gray(H)), [], 'XData',T, 'YData',R, ...
'InitialMagnification','fit')
xlabel('\theta (degrees)'), ylabel('\rho')
axis on, axis normal, colormap(hot), colorbar, hold on
%# detect peaks
P = houghpeaks(H, 20, 'threshold',ceil(0.5*max(H(:))));
plot(T(P(:,2)), R(P(:,1)), 'gs', 'LineWidth',2);
%# detect lines and overlay on top of image
lines = houghlines(BW, T, R, P, 'FillGap',50, 'MinLength',5);
figure, imshow(I), hold on
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1), xy(:,2), 'g.-', 'LineWidth',2);
end
hold off
Run Code Online (Sandbox Code Playgroud)



您可以在其他区域尝试相同的过程,同时调整参数以获得良好的结果。