필터 지우기
필터 지우기

How could I Remove the border outside a number?

조회 수: 2 (최근 30일)
H LIU
H LIU 2020년 12월 4일
댓글: H LIU 2020년 12월 7일
hi,everyone:
could you tell me the way to delete the border outside the number '5' ?
thank you!

답변 (1개)

Image Analyst
Image Analyst 2020년 12월 4일
As long as the box is not touching the 5, you can label it and call bwlabel to get blobs 1-6 and 8. Blob #7 will be the box.
% Make sure it's binary
mask = yourImage > 128;
[labeledImage, numRegions] = bwlabel(mask);
% Extract blobs 1-6 and 8
maskWithoutBox = ismember(labeledImage, [1,2,3,4,5,6,8]);
If the box touches the 5, then you're going to have to do tricker things (morphology like imopen or imerode) to separate them.
  댓글 수: 1
H LIU
H LIU 2020년 12월 7일
Thank You Sincerely!
With the help of you,this problem has been solved.
BW = imread('*.png');
se = strel('disk',2);
BW1 = imopen(BW,se);
figure;
imshow(BW1,[]);

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by