フィルターのクリア

removing the pixels with different size and unregular shape

5 ビュー (過去 30 日間)
sedigheh pagheh
sedigheh pagheh 2022 年 7 月 26 日
コメント済み: sedigheh pagheh 2022 年 7 月 27 日
Hi everyone
I want to delete some pixels in my binary image and keep some others. I have tried but the solutions like defining structuring element did not work.
I would be grateful if you could help me or share your ideas about the possible solutions.
The image and a screenshot with the marked wanting pixels is attached

採用された回答

Image Analyst
Image Analyst 2022 年 7 月 27 日
Out of all the blobs in the image, why those specific 3? What's different about those 3 blobs? Will they always be there? If so just use bwselect or simply mask out those pixels with some known template. If they change shape, size, and location then it might be better to just improve your segmentation algorithm so that they don't get created in the first place.
  5 件のコメント
Image Analyst
Image Analyst 2022 年 7 月 27 日
Then bwselect is what you want. You can specify a row and column and a binary image and it will extract blobs that are true at that location. Then you can use that to erase it from the binary image. Let's say you want to delete the blob that has a white pixel at row 30 and column 100. You could do
blobToErase = bwselect(binaryImage, 100, 30); % One single blob.
binaryImage(blobToErase) = false; % Remove that blob from the image.
sedigheh pagheh
sedigheh pagheh 2022 年 7 月 27 日
Thank you so much.

サインインしてコメントする。

その他の回答 (1 件)

Chunru
Chunru 2022 年 7 月 27 日
A simple approach is to find the regions you want to deleted (assign 0). Four your question, rectangle regions are sufficient:
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1078370/image.jpg');
subplot(121); imshow(I);
xline([60 220 1180 1380], 'r')
yline([1050 1380 1940 2300], 'r')
I(1050:1380, 60:220) = 0;
I(1940:2300, 1180:1380)=0;
subplot(122); imshow(I)
xline([60 220 1180 1380], 'r')
yline([1050 1380 1940 2300], 'r')
% mode(I(:))
  1 件のコメント
sedigheh pagheh
sedigheh pagheh 2022 年 7 月 27 日
編集済み: sedigheh pagheh 2022 年 7 月 27 日
thank you for your solution. I try to apply it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by