TryingToLearn
TryingToLearn

Reputation: 93

Edge detection in pixelated images

I am trying to find different approaches for how to find edges in a pixelated image such as this one:

enter image description here

By edges I mean the clear lines that are showing from the pixels(blocks), not the edges from skin to background etc.
Does anyone got a tips for how to find these edges?
Would a Sobel filter be able to detect these lines as edges?

I have not tested anything yet, I am more looking into options on what type of filters exist.
I will be implementing the stuff in C++ and DirectX12.

Upvotes: 0

Views: 240

Answers (1)

Rotem
Rotem

Reputation: 32094

There is a large selection of filters.

Result of MATLAB edge function applying different types of filters:

enter image description here

I looks like 'Canny' and 'approxcanny' gives the best result.

According to MATLAB documentation:

The 'Canny' and 'approxcanny' methods are not supported on a GPU.

It probably means that 'Canny' filter is less fitted for GPU implementation.


Here is the MATLAB code:

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

Upvotes: 1

Related Questions