Select shape from multiple closed borders in Image to obtain cell information/index from cell array B

rgbFrame = readFrame(VideoObject) ; % Read video frame in RGB
gFrame = rgb2gray(rgbFrame) ; % Convert frame to Grayscale
bwFrame = imbinarize(gFrame, 'adaptive' ) ; % Convert gFrame to bwFrame
bwFrame = bwareaopen( bwFrame , 100 ) ; % Remove noise from bwFrame
bwFrame = imfill(bwFrame, 'holes') ; % Fill holes
[B,L] = bwboundaries(bwFrame,'noholes') ; % Obtain shape boundaries
Using the code above, I obtain a cell array of B with the borders of several closed shapes in my video frame. I would like to display all of the shapes on an image, select with the cursor (Maybe "ButtonDownFcn"?) the intended shape, and create a new cell array called "Circle" with only the information from the intended shape.

Answers (0)

Asked:

on 25 Jun 2020

Edited:

on 25 Jun 2020

Community Treasure Hunt

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

Start Hunting!