How to remove square shape part from image and detect the bubbles around squares?
Show older comments

3 Comments
darova
on 25 Mar 2020
Did you try something? What about im2bw(binarization)? Any ideas?
Adam Danz
on 25 Mar 2020
Here's several starting points I found by searching for "bubbles" in the forum
- https://www.mathworks.com/matlabcentral/answers/214643-detecting-bubbles-using-image-segmentation
- https://www.mathworks.com/matlabcentral/answers/478256-bubbles-analysis-measure-and-count-bubbles
- https://www.mathworks.com/matlabcentral/answers/346941-how-to-track-bubbles-in-photo-s-and-determin-the-velocity
Suresh Bhanoth
on 25 Mar 2020
Accepted Answer
More Answers (1)
Image Analyst
on 26 Mar 2020
Assuming the square is in the same location for every image, you can simply create a mask with poly2mask() and then mask it away.
[rows, columns, numColorChannels] = size(rgbImage);
mask = poly2mask(xCorners, yCorners, rows, columns); % You can find out x and y with imtool()
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));
Or see my masking demos.
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!