grayImage = imread('monkey.png'); % Read in standard MATLAB gray scale image.
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image');
hFH = imfreehand(); %Choose ROI using freehand tool
binaryImage = hFH.createMask(); % Create a binary image ("mask") from the ROI object.
subplot(2, 2, 2);
imshow(binaryImage);
title('Binary mask of the region');