Info

この質問は閉じられています。 編集または回答するには再度開いてください。

create freehand region of interest

1 回表示 (過去 30 日間)
John Pediani
John Pediani 2019 年 10 月 3 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a matlab program which I would like to be able to draw a free hand ROI on the loaded image, If I dropped off the software could someone introduce this. Currently we can only draw a square or rectangle

回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2019 年 10 月 3 日
Have a look at ginput (there are a couple of improved/modified versions on the file exchange), that function should give you the tool to chose arbitrary polygons for your area. After that I'd use inpolygon to determine what pixels are inside the ROI. Something like this:
imagesc(im)
[xPerim,yPerim,Bperim] = ginput;
idx1 = 1:size(im,1);
idx2 = 1:size(im,2);
[idx2,idx1] = meshgrid(idx2,idx1);
inROI = inpolygon(idx2,idx1,xPerim(:),yPerim(:));
HTH

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by