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!