hi,
I used this for free hand drawing in an irregular shape. But I need to draw a box to select a region.
% Get the input free hand image
figure, imshow(grayImage, []); axis on; title('Contour Region Required', 'FontSize', fontSize); set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
message = sprintf('Left click and hold to begin drawing.\nRelease Mouse Button when Completed'); uiwait(msgbox(message)); hFH = imfreehand(); % Create a binary image ("mask") from the ROI object.
binaryImage = hFH.createMask(); xy = hFH.getPosition; % Label the binary image and compute the centroid and center of mass.
labeledImage = bwlabel(binaryImage); % Will keep only the part of the image that's inside the mask, zero outside mask.
blackMaskedImage = grayImage; blackMaskedImage(~binaryImage) = 0;
Can you please suggest me free hand drawing a box.
Thanks…
Best Answer