Info
This question is closed. Reopen it to edit or answer.
create freehand region of interest
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Bjorn Gustavsson
on 3 Oct 2019
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
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!