How to detect contents of a beaker in an image

1 回表示 (過去 30 日間)
MM
MM 2022 年 11 月 29 日
コメント済み: MM 2023 年 2 月 9 日
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 件のコメント
Image Analyst
Image Analyst 2023 年 2 月 7 日
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.
MM
MM 2023 年 2 月 9 日
Attached you can find three ".mat files" containing the data matrix needed to make the bare figure. Each file has a different situation in which either the volume is different or the content of the beaker has different intensities. I will also try out DGMs suggestion which looks promising.

サインインしてコメントする。

回答 (2 件)

DGM
DGM 2023 年 2 月 7 日
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.

Mandar
Mandar 2023 年 2 月 6 日
編集済み: Mandar 2023 年 2 月 6 日
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.

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by