How to detect contents of a beaker in an image
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have an image of a beaker in which I want to automatically detect the contents of the beaker. I cannot use the intensity for this because sometimes the intensity of the beaker content is the same as the one in the walls. Also the the length and height of the beaker content is not always the same. Is there a method that I can use to create a mask for just the beaker content without having to do it manually?
8 comentarios
Image Analyst
el 7 de Feb. de 2023
Attach the original image, not a screenshot with tick marks, tick labels, and other stuff. We want just the bare image. Not a figure or .fig file, just the original .tiff, .jpg, or .PNG file.
Respuestas (2)
DGM
el 7 de Feb. de 2023
Here's an initial attempt. How well this works really depends on how vague the gap between the blobs can be. As Walter mentions, if there are images other than screenshots, that would probably help too.
% read the images
A = imread('bk1.png');
B = imread('bk2.png');
imshow(generatemask(A))
imshow(generatemask(B))
function mk = generatemask(inpict)
% try to make things less sensitive to value
inpict = imadjust(inpict);
% binarize (idk how well this will work across all images)
mk = imbinarize(inpict,'adaptive','sensitivity',0.7);
% clean up the mask
mk = imopen(mk,ones(5)); % try to break any small bridges
mk = imfill(mk,'holes'); % fill any holes
mk = bwareaopen(mk,10E3); % get rid of small blobs
mk = bwpropfilt(mk,'extent',[0.85 1]); % keep blobs which are roughly grid-aligned rectangles
mk = bwareafilt(mk,1); % keep the largest remaining blob
end
As to how to apply watershed segmentation to this problem, I'm not the one to ask, but if it's a particularly good use-case, I'd like to see an example applied to this specific problem.
0 comentarios
Mandar
el 6 de Feb. de 2023
Editada: Mandar
el 6 de Feb. de 2023
Looking at the image, the watershed-based segmentation approach could be a good starting point to segment out the content in the bicker. Refer the following MATLAB documentation link to know more about watershed segmentation.
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!