Filter löschen
Filter löschen

Deleting Objects in Binary Image

2 Ansichten (letzte 30 Tage)
S_run
S_run am 5 Feb. 2021
Beantwortet: Nitin Kapgate am 8 Feb. 2021
Hello,
I have a binary image containing several white objects. I was able to identify which object I want to delete by using bwselect(), but when I tried to subtract the images(the main image with all objects - image containing only object I want to delete), the unwanted object was still there. How can I delete this object?
Thank you
  1 Kommentar
KALYAN ACHARJYA
KALYAN ACHARJYA am 5 Feb. 2021
Can you attach the sample image (specify the object differently, which to be deleted)?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Nitin Kapgate
Nitin Kapgate am 8 Feb. 2021
You can refer the following code snippet which demonstrates use of interactive behaviour of bwselect function to solve your problem.
close all;
BW = imread('circlesBrightDark.png');
% get a binary image wirh only white objects
BW = BW > 128;
% display original Binary image
figure
imshow(BW);
% You can use the bwselect function to select individual objects in a binary image.
% Specify pixels in the input image programmatically or interactively with a mouse.
% After you are done specifying the pixels in the object, double click within
% an object you want to keep in the output image.
% bwselect returns a binary image that includes only those objects from the
% input image that contain one of the specified pixels.
BW2 = bwselect;
% display BW2 image with selected objects
figure
imshow(BW2);
figure
subplot(1,2,1); imshow(BW);
subplot(1,2,2); imshow(BW2);

Kategorien

Mehr zu Graphics Object Programming 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