【问题标题】:Line detection in noisy image (and no detection when it is not present)噪声图像中的线检测(不存在时不检测)
【发布时间】:2017-03-29 17:17:36
【问题描述】:

我尝试在非常嘈杂的图像中提取暗线,但没有成功。一些提示?

第一个示例的当前步骤:

1) Clahe:clip_limit = 10 和 grid_size = (8,8)

2) Box Filter: 大小 = (5,5)

3) Inverted Image: 255 - 图片

4) Threshold: 当倒置图像

更新

我已经执行了一些预处理步骤来提高测试图像的质量。我调整了我的 ROI 蒙版以上下裁剪(因为它们的强度很低)并添加了照明校正以更好地查看线条。关注当前图片:

【问题讨论】:

  • 提供有关您的方法的更多信息。哪些有效,哪些无效。
  • 当然,@m3h0w。我当前的步骤: 1)Clahe:clip_limit = 10 和 grid_size = (8,8) 2) Box Filter: size = (5,5) 3) Inverted Image 4) Threshold: 当inverted_image
  • 我想使用RANSAC来检测暗线,但是在这一步之前我需要“清理”图像。
  • 您应该更新问题,最好提供一些结果图片。
  • 我改进了这个问题。

标签: image-processing line noise-reduction


【解决方案1】:

即使图像很嘈杂,您也只是在寻找图像北边的直线。那么,为什么不使用某种具有形态学运算的匹配滤波器呢?

编辑:我已经修改了。

1) 沿 x 和 y 轴使用中值滤波器,并对图像进行归一化。 2) 匹配所有可能的线方向的过滤器。

% im=imread('JwXON.png');
% im=imread('Fiy72.png');
% im=imread('Ya9AN.png');
im=imread('OcgaIt8.png');

imOrig=im;

matchesx = fl(im, 1);
matchesy = fl(im, 0);

matches = matchesx + matchesy;

[x, y] = find(matches);

figure(1);
imagesc(imOrig), axis image
hold on, plot(y, x, 'r.', 'MarkerSize',5)
colormap gray


%----------

function matches = fl(im, direc)

if size(im,3)~=1
    im = double(rgb2gray(im));
else
    im=double(im);
end
[n, m] = size(im);

mask = bwmorph(imfill(im>0,'holes'),'thin',10);
indNaN=find(im==0); im=255-im; im(indNaN)=0;

N = n - numel(find(im(:,ceil(m/2))==0));
N = ceil(N*0.8); % possible line length

% Normalize the image with median filter
if direc
    background= medfilt2(im,[1,30],'symmetric');
    thetas = 31:149;
else
    background= medfilt2(im,[30,1],'symmetric');
    thetas = [1:30 150:179];
end

normIm = im - background;
normIm(normIm<0)=0;

% initialize matched filter result
matches=im*0;

% search for different angles of lines
for theta=thetas
    normIm2 = imclose(normIm>0,strel('line',5,theta));
    normIm3 = imopen(normIm2>0,strel('line',N,theta));
    matches = matches + normIm3;
end

% eliminate false alarms
matches = imclose(matches,strel('disk',2));
matches = matches>3 & mask;
matches = bwareaopen(matches,100);

【讨论】:

  • 嗨@Ozcan,这是一个很好的解决方案。感谢您的回复,但如果这条线垂直于图像查看器,我们如何也能检测到它?沿 y 轴使用中值滤波器?
  • 是的,您必须沿 y 轴进行中值过滤。但也需要更改 for 循环中的 theta 值。如果您提供示例图片,我可以安排代码。
  • @RômuloCerqueira,我修改了我的答案。但是请记住,这只是一个想法,在某些情况下可能行不通。
  • 谢谢@Ozcan。你的想法真的很有用。
  • 您好,有没有更好的方法来查找线路并避免误报率?
猜你喜欢
  • 1970-01-01
  • 2017-08-04
  • 2018-11-09
  • 2012-01-04
  • 1970-01-01
  • 1970-01-01
  • 2014-06-01
  • 2017-07-11
  • 1970-01-01
相关资源
最近更新 更多