How to remove some detected edges from the edge map ?

2 visualizaciones (últimos 30 días)
Piyum Rangana
Piyum Rangana el 11 de Mayo de 2017
Comentada: Piyum Rangana el 20 de Mayo de 2017
Using the prewitt edge detector I obtained the below output.
edge(grayImage,'Prewitt')
How can I remove edges of the blue circled area from this edge map. the original image I attached herewith.

Respuestas (1)

Gautham Sholingar
Gautham Sholingar el 15 de Mayo de 2017
The following code snippet will allow you to automatically select the region you want to remove by double-clicking the region and then remove the extra section.
img = imread('king.png'); % assuming king.png is the original image called 2.png
figure;
subplot(3,1,1)
imshow(img)
t = title('Double-Click on the region you want to remove!',...
'fontsize',12,'color','r');
h = impoint;
pos = round(h.getPosition);
rgbIndices = rgb2ind(img,5);
SE = strel('Disk',1,4);
for ii = 0:4
thisMask = ismember(rgbIndices,ii);
thisMask = imfill(thisMask,'holes');
thisMask = imopen(thisMask, SE);
thisMask = bwareaopen(thisMask,100);
[y,x] = find(thisMask);
if all(ismember(pos,[x,y]))
maskInd = ii;
break
end
end
subplot(3,1,2)
imshow(thisMask)
%
subplot(3,1,3)
outline = edge(rgb2gray(img),'Prewitt');
newOutline = outline & ~imdilate(thisMask,SE);
imshow(newOutline);
end
Copy this code and run this as a script with the image open and then select the section you want to remove.
  1 comentario
Piyum Rangana
Piyum Rangana el 20 de Mayo de 2017
Thank you so much for the answer. Actually what I tried to do was remove those areas (So called damaged or degraded) and take the output image. Then I tried to recover the damaged edges. Can I do that in this way ?

Iniciar sesión para comentar.

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by