How Can I remove lines from the below images?

2 ビュー (過去 30 日間)
Ramanathan Anandarama Krishnan
Ramanathan Anandarama Krishnan 2022 年 3 月 16 日
回答済み: yanqi liu 2022 年 3 月 17 日
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.

回答 (3 件)

Simon Chan
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');

Matt J
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
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
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

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by