MATLAB Answers


How manually deselect an object after segmentaion?

Asked by Aidin
on 14 Nov 2013
Latest activity Commented on by Aidin
on 17 Nov 2013

I have been doing Cell segmentation using circular hough transform. I used imfindcircles to detect cells and RemoveOverLap to remove some unwanted overlaps. everything seems to work fine but i need to give the user the ability to deselect any of cells. i have been playing around and because cell detection is based on the center and radius , if i want to delete any of the cells i need both center and radius, i could manage to get the center but no luck with radius. i need to somehow either get the radius or delete segmented cell some other way. below are the codes i am using:

image url:

         img1 = imread('Overlap_3.jpg');
         img = rgb2gray(img1);
         threshold = graythresh(img);
         img = im2bw(img,threshold);
         img = ~img;
         img = imfill(img,'holes');
         figure, imshow(img);
         img = bwareaopen(img,150);
         %figure, imshow(img);
         [centers, radii] = imfindcircles(img,[30 50],'Sensitivity',0.95,'Edge',0.8);
         %figure, imshow(img);
         figure, imshow(img1);
         hold on
         viscircles(centers, radii,'EdgeColor','g')
         [centersNew, radiiNew]=RemoveOverLap(centers,radii,40,2);
         figure, imshow(img1);
         hold on
         viscircles(centersNew, radiiNew,'EdgeColor','g');

thank you in advanced


2 Answers

Answer by Image Analyst
on 17 Nov 2013
 Accepted answer

If you use ginput, then check which of the centers is closest to that will let you know which circle the user pointed to.

  1 Comment

I have not used ginput so far, but it seems pretty much what i needed to do. Thank you so much i will update if it worked.

Answer by Walter Roberson
on 14 Nov 2013

Take your img and bwlabel it. When the user selects a cell using something like ginput(), round the coordinates to the closest integers, index the label image at that coordinate to find the index of the blob it is. Set all pixels with the same label clear. You can then proceed with finding the circles or whatever.

  1 Comment

The problem is i dont want to use bwlable cause i am already using hough transform for circular detection.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!