How Can I remove lines from the below images?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ramanathan Anandarama Krishnan
el 16 de Mzo. de 2022
Respondida: yanqi liu
el 17 de Mzo. de 2022
Dear All,
I need to remove the extra lines (the one in black at center for front view image) and another lines (ones in white for side view image)? I need only the basic part of the image to be displayed. Codes like bwareaopen, errosion,dilation etc do not work. Since all the components are in same pixel values (1177 *948), I am having a tough time. Please help.
0 comentarios
Respuestas (3)
Simon Chan
el 16 de Mzo. de 2022
Try this:
clear; clc;
data = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/928744/Stryker_Triathlon%20CR_Total%20Knee.JPG');
se = strel('disk',5);
BW = bwareafilt(imopen(data,se)>0,2);
output = data.*uint8(BW);
subplot(2,2,1)
imshow(data,[]);
title('Origianl image');
subplot(2,2,2)
imshow(output,[]);
title('Extracted image');
subplot(2,2,3)
imshow(imabsdiff(data,output),[]);
title('Image Difference');
0 comentarios
Matt J
el 16 de Mzo. de 2022
Editada: Matt J
el 16 de Mzo. de 2022
For the first image, I recommend bwlalphaclose() from,
The second image seems maangeable with bwareafilt().
load Images
Ac=bwlalphaclose(A,7,'objects');
Bc=bwareafilt(imopen(B,strel('disk',5)),2);
montage({Ac,Bc},'Ba','w','Bo',5)
1 comentario
Matt J
el 16 de Mzo. de 2022
imclose() seems to work okay on the first image as well.
load Images
Ac=imclose(A,strel('disk',7));
Bc=bwareafilt(imopen(B,strel('disk',5)),2);
montage({Ac,Bc},'Ba','w','Bo',5)
yanqi liu
el 17 de Mzo. de 2022
urls = {'https://www.mathworks.com/matlabcentral/answers/uploaded_files/928744/Stryker_Triathlon%20CR_Total%20Knee.JPG','https://ww2.mathworks.cn/matlabcentral/answers/uploaded_files/928739/Stryker_Triathlon%20CR_Total%20Knee.JPG'};
for i = 1 : length(urls)
img = imread(urls{i});
if ndims(img) == 3
img = rgb2gray(img);
end
bw = im2bw(img);
bw2 = imopen(bw, strel('disk', 7));
img2 = img .* uint8(bw2);
figure(i);
subplot(1,3,1); imshow(img, []); title('origin image');
subplot(1,3,2); imshow(bw, []); title('filter logical image');
subplot(1,3,3); imshow(img2, []); title('filter image');
end
0 comentarios
Ver también
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!