I'm wanting to create multiple closed unconnected shapes using roipoly. I can do this fine for 2 shapes but when I add in the code for a 3rd shape it always connects the last coord of the 3rd shape to the first coord of the 1st shape.
if truexmask_temp = [];ymask_temp = [];junk = [];for i=1 A=imread(['Image0001.bmp']); [junk,xmask_temp,ymask_temp]=roipoly(A); a = 1+size(xmask_temp,1); xmask(1:size(xmask_temp,1),i)=xmask_temp; ymask(1:size(ymask_temp,1),i)=ymask_temp; [junk,xmask_temp,ymask_temp]=roipoly(A); b = a-1+size(xmask_temp,1); xmask(a:b,i)=xmask_temp; ymask(a:b,i)=ymask_temp; b = b+1; [junk,xmask_temp,ymask_temp]=roipoly(A); % where the problem starts
c = b-1+size(xmask_temp,1); xmask(b:c,i)=xmask_temp; ymask(b:c,i)=ymask_temp;endB = roipoly(A,xmask,ymask);imshow(B);
Best Answer