How to remove this small round shaped error highlighted in the image below.
1 次查看(过去 30 天)
显示 更早的评论
How to remove this small round shaped error highlighted in the image below.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678823/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678823/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678828/image.png)
2 个评论
DGM
2021-7-9
编辑:DGM
2021-7-9
Describe what makes this the error. Is it the size? The location? Is this the only one in the image? Is this the only image that needs to be processed? Is this the whole image?
You said "small round error", but you highlighted the entire blob. I'm assuming you're just trying to get rid of the round part, but they're a 4-connected group based on the strel chosen for dilation. Is that even an error?
You might want to post a copy of the actual image. Captured plots of images are basically screenshots. They contain extraneous padding and are subject to destructive interpolation and aren't intended for anything other than looking at with your eyeballs. If you want anyone to be work with your actual image, post the actual image instead of a damaged copy.
回答(1 个)
DGM
2021-7-9
Again, this is subject to questions, and is based on a modified screenshot.
% load the image and fix it
ip = imread('image.png');
ip = cropborder(ip,[NaN NaN NaN NaN]); % from MIMT
ip = rgb2gray(ip)>245;
% break the group and remove small blob
ip = ~bwmorph(~ip,'bridge');
ip = bwareaopen(ip,100);
% display
imshow(ip)
Cropborder() is from MIMT on the FEX. You shouldn't need to use it, because trust you're not processing screenshots.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!