How Can I remove lines from the below images?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
Simon Chan
2022-3-16
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 个评论
Matt J
2022-3-16
编辑:Matt J
2022-3-16
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 个评论
Matt J
2022-3-16
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
2022-3-17
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!