bwareaopen creates a noisy result rather than cleanly removing small objects
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi. I want to remove the diacritics from some arabic text. I read that the best option would be to use morphological opening. And hence the function
bwareaopen
Now in the example in the link here: http://www.mathworks.co.uk/help/images/ref/bwareaopen.html it has cleanly removed small objects. But in my case it tends to produce a noisy result
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155355/image.jpeg)
This is with the pixel value of 50, but produces the same result even if I use 5 or 500?
Why is it not working as it is shown in the tutorial?
Thank you
댓글 수: 0
채택된 답변
Bruno Pop-Stefanov
2014년 1월 20일
Make sure that you call bwareaopen on a binary image. I executed the following code on the attached JPEG image and it worked:
% Read original image
I = imread('inputimg.jpg');
figure(1);
imshow(I)
% Convert to binary image
BW = im2bw(I, 0.5);
figure(2);
imshow(BW)
% Do morphological opening to remove small connected components
BW2 = bwareaopen(BW, 50);
figure(3);
imshow(BW2)
댓글 수: 2
Bruno Pop-Stefanov
2014년 1월 20일
Great! Can you please accept my answer? I believe there is a link on the left.
추가 답변 (1개)
Image Analyst
2014년 1월 20일
It looks like you somehow ran it on the uint8 jpeg image instead of a binary image. I can see jpeg block artifacts.
When it says "numeric array" it probably means that if you give it a double array of 0's and 1's it will interpret that automatically as a binary image of trues and falses. I don't think it means it can take a gray scale image.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!