MATLAB Answers

0

create freehand region of interest

Asked by John Pediani on 3 Oct 2019
Latest activity Answered by Bjorn Gustavsson on 3 Oct 2019
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

Sign in to comment.

1 Answer

Answer by 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

Sign in to comment.