% Another simple way to choose a square in the middle
% of an image and turn it black.
%
% Samuli Siltanen November 2014

% Load image 
im = imread('Tokyo2048.tif','tif');
im = double(im);

% Downsample image
im = MyDS2(im); % 1024x1024
im = MyDS2(im); % 512x512
im = MyDS2(im); % 256x256
im = MyDS2(im); % 128x128
im = MyDS2(im); % 64x64

% Normalize image: pixel values between zero and one
im = im-min(im(:));
im = im/max(im(:));

% Create a version of the image with black 
% middle square
im2 = im;
im2(round(end/3):round(2*end/3),round(end/3):round(2*end/3)) = 0;

% Take a look
figure(1)
clf
imagesc([im,im2])
colormap gray
axis equal
axis off
