% 
% Manfred Klaffenboeck
% a00301042
% University of Vienna
% WS18 - SIP Tutorial 
%           Example Solution DIP-Project4.1
%
% CHECKERBOARD negate every odd-positioned value in an image
%
%   INPUT:
%       sY              size for y
%       sX              size for x
%   OUTPUT:
%       retval          2d-matrix, containing 1 and -1 only 
%                           in checkerboard style

function [retval] = checkerboard(sY,sX)

    % create a template for repeating
    template = [1 -1; -1 1];
    
    % repeat the template to fit the size of given dimensions
    arr = repmat(template, ceil(sY/2),ceil(sX/2));
    
    % cutoff possible additional values
    retval = arr(1:sY, 1:sX);
end

