remove unwanted black pixels from binary image

5 Ansichten (letzte 30 Tage)
Abhinav Singh
Abhinav Singh am 24 Feb. 2020
Kommentiert: Adam Danz am 14 Mai 2020
I have a binary image of a zebra fish. im trying to segment the fish but im getting the unwanted black pixels from the image. Im attaching two images- one with unwanted black pixels and one without unwanted black pixels.
  5 Kommentare
Rena Berman
Rena Berman am 14 Mai 2020
(Answers Dev) Restored edit
Adam Danz
Adam Danz am 14 Mai 2020
Copy of question
I have a binary image of a zebra fish. im trying to segment the fish but im getting the unwanted black pixels from the image. Im attaching two images- one with unwanted black pixels and one without unwanted black pixels.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Subhadeep Koley
Subhadeep Koley am 24 Feb. 2020
It is difficult to fill the binary image exactly as you want but twaeking the various parameters of the function bwmorph we can go pretty close. Perform the following operations on your binary image.
b = bwmorph(b, 'close', Inf);
b = imfill(b,'holes');
se = strel('line', 8, 30);
b = imerode(b, se);
b = bwmorph(b, 'majority', Inf);
figure; imshow(b);

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by