hf = figure(1);
A = imread('board.tif');
A = rgb2gray(A);
imshow(A)
rect = getrect(hf);
w = round(rect(3));
h = round(rect(4));
r = [rect(1),rect(1)+w,rect(1)+w,rect(1);rect(2),rect(2),rect(2)+h,rect(2)+h];
rectangle('Position',[rect(1),rect(2),w,h], 'edgecolor','red');
figure(2);
bw = roipoly(A,r(1,:),r(2,:));
B = A(bw);
B = reshape(B, h, w);
imshow(B);
hf = figure(1);
A = imread('board.tif');
A = rgb2gray(A);
imshow(A)
rect = getrect(hf);
w = round(rect(3));
h = round(rect(4));
r = ;
rectangle('Positi ...