How Can I do image extraction of chosen region?

4 ビュー (過去 30 日間)
Ali Zulfikaroglu
Ali Zulfikaroglu 2020 年 12 月 28 日
コメント済み: Ali Zulfikaroglu 2021 年 1 月 6 日
I have an mammogram image . I use roipoly command to draw tumor suspicious area . Maybe something easier ways to draw that blue polygon.
My question is I need to extract that blue polygon tumor suspicious region from original image and then I will segment that extracted image.
How Can I do that ?
(The image was taken from mias database).

採用された回答

Image Analyst
Image Analyst 2020 年 12 月 29 日
Once you have the mask, do this:
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
% Works for gray scale as well as RGB Color images.
maskedImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));
changing the names to whatever you want to call them.
  12 件のコメント
Image Analyst
Image Analyst 2021 年 1 月 5 日
I already told you:
mask = false(rows, columns);
drawAnother = true;
while drawAnother
thisMask = roipoly(); % or however you want to get it.
mask = mask | thisMask;
% ask user if they want to draw another with questdlg().
promptMessage = sprintf('Do you want to Continue processing,\nor Quit processing?');
titleBarCaption = 'Continue?';
buttonText = questdlg(promptMessage, titleBarCaption, 'Continue', 'Quit', 'Continue');
if contains(buttonText, 'Quit', 'IgnoreCase', true)
drawAnother = false;
end
end
Now mask will have several polygon regions on it and you can just pass it to regionprops():
props = regionprops(mask, 'All'); % Or whatever measurements you want.
Ali Zulfikaroglu
Ali Zulfikaroglu 2021 年 1 月 6 日
Thank you really image analyst . I added your function bsxfun and got the result which I want.

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

その他の回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 12 月 29 日
編集済み: KALYAN ACHARJYA 2020 年 12 月 29 日
Steps:
  • Draw
  • Right Click (Cursor above the Drawing)
  • Create Mask
  • Save the Mask
  3 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 12 月 30 日
編集済み: KALYAN ACHARJYA 2020 年 12 月 30 日
After these steps, please follow Image Anayst answer (Below)
Ali Zulfikaroglu
Ali Zulfikaroglu 2020 年 12 月 30 日
Thank for your suggestion also, image analyst answer works

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

Community Treasure Hunt

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

Start Hunting!

Translated by