【发布时间】:2018-03-26 13:22:12
【问题描述】:
给定一个包含斜线的二进制图像,我如何自动识别尽可能多的线?使用 Matlab 中的bwtraceboundary 函数,我已经能够识别其中之一,手动提供识别线的起始坐标。
谁能指出一种循环 1 和 0 矩阵以自动识别尽可能多的方法?
这是一个示例图像:
% Read the image
I = imread('./synthetic.jpg');
figure(1)
BW = im2bw(I, 0.7);
imshow(BW2,[]);
c = 255; % X coordinate of a manually identified line
r = 490; % Y coordinate of a manually identified line
contour = bwtraceboundary(BW,[c r],'NE',8, 1000,'clockwise');
imshow(BW,[]);
hold on;
plot(contour(:,2),contour(:,1),'g','LineWidth',2);
从上面的代码我们得到:
【问题讨论】:
-
咳咳咳咳*! (线的霍夫变换)
-
在我提供的图像中使用霍夫变换是否可以有一个最小的可重现示例?否则,您能否指出任何有用的信息来源?谢谢
-
Hum.... 从字面上看,“Hough tranform for lines”为您提供了一个完整的 Google 教程,由 Mathworks 提供,使用
houghlines函数....
标签: image matlab image-processing