You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: deres.m
    path of file: ./repos/Image-Harmonization-Dataset-iHarmony4/Lalonde and Efros/utils/3rd_party/pkovesi/Misc
    
    the code of the file until where you have to start completion: % DERES -  Deresolves an image.
%
% Usage:  im2 = deres(im, s)
%
% Arguments:  im  - image to be deresolved
%             s   = deresolution factor
%
% Returns the deresolved image

% PK October 2000

f
    
function im2 = deres(im, s)

    if ndims(im) == 3  % Assume colour image
	im2 = zeros(size(im));
	im2(:,:,1) = blkproc(im(:,:,1),[s s], 'mean2(x)');
	im2(:,:,2) = blkproc(im(:,:,2),[s s], 'mean2(x)');
	im2(:,:,3) = blkproc(im(:,:,3),[s s], 'mean2(x)');
    else
	im2 = blkproc(im,[s s], 'mean2(x)');
    end