如何检测灰度图上的直线?

How to detect straight lines on grayscale images?

我有一些灰度图,如下图:

这张图片就像一个“圆盘”,在非黑色区域包含了很多噪点。我想检测其中的线。这条线肉眼很容易看到,但电脑很难看到。为了更好地演示,我分发了这条线。

现在我尝试了很多方法,比如Hough Line变换,Radon变换等等。但是,很难说是我用错了,还是那些方法不适用于这个任务。

我是图像处理的初学者。这里有人可以提供一些想法吗?非常感谢!

您可以尝试使用 Gabor 过滤器。这是一个开始:

img = imread('https://i.stack.imgur.com/sHA7w.png');
% gray out empty spaces
img(img == 0) = 123;
% create gabor filter bank
wavelength = 6;
orientation = 5:5:180;
g = gabor(wavelength,orientation);
outMag = imgaborfilt(img,g);
% plot the magnitude at peak orientation
ii = 23;
figure
imagesc(outMag(:,:,ii))
title(['Magnitude at ',num2str(orientation(ii)),'deg'])
% create a mask
mask = outMag(:,:,ii) > 250;
figure;
imshow(mask)

你仍然需要检测你在哪一层获得了高强度,并过滤掩码以隐藏边缘和小块。