a = imread('PSWebImageBitMap0001.bmp',  'bmp');
b = double(a(:,:,2));
level = graythresh(b);
BW = im2bw(b,level);

figure(3)
clf
imshow(BW)
title('Global image threshold using Otsu method')