function im = mask_im(im)

im = double(im)/255;
im_sum = sum(im,3);
mask_index = (im_sum == 0);
if size(im,3) == 3
   for i = 1:size(im,3)
       im_one = im(:,:,i);
       im_one(mask_index) = 0.5;
       %im_one(mask_index) = 1.0;
       im(:,:,i) = im_one;
   end
else
   im(mask_index) = 0.5;
end
