像素化图像的边缘检测

时间:2020-01-21 14:22:15

标签: image-processing filter

我正在尝试找到不同的方法来查找像这样的像素化图像中的边缘:

enter image description here

所谓边缘,是指从像素(块)显示的清晰线条,而不是从皮肤到背景等的边缘。
有人知道如何找到这些边缘吗?
Sobel滤波器能够将这些线检测为边缘吗?

我尚未进行任何测试,我正在研究存在哪种类型的过滤器的选项。
我将在C ++和DirectX12中实现这些功能。

1 个答案:

答案 0 :(得分:1)

有很多过滤器可供选择。

使用不同类型的过滤器的MATLAB edge函数的结果:

enter image description here

我看起来'Canny'和'approxcanny'给出了最好的结果。

根据MATLAB文档:

GPU不支持'Canny'和'approxcanny'方法。

这可能意味着“ Canny”过滤器不太适合GPU实现。


这是MATLAB代码:

I = imread('images.jpg'); %Read image.

I = rgb2gray(I); %Convert RGB to Grayscale.

%Name of filters.
filt_name = {'sobel', 'Prewitt', 'Roberts', 'log', 'zerocross', 'Canny', 'approxcanny'};

%Display filtered images
figure('Position', [100, 100, size(I,2)*4, size(I,1)*4]);
for i = 1:length(filt_name)    
    %Filter I using edge detection filtes of type 'sobel', 'Prewitt', 'Roberts'...
    %Use default MATLAB parameters for each filter.
    J = edge(I, filt_name{i});

    subplot(3, 3, i);
    image(im2uint8(J));
    colormap('gray');
    title(filt_name{i});
    axis image;axis off
end
相关问题