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: imOverlay.m
    path of file: ./repos/matImage/matImage/imFilters
    
    the code of the file until where you have to start completion: function res = imOverlay(img, varargin)
%IMOVERLAY Add colored markers to an image (2D or 3D, grayscale or color)
%
%   Usage
%   OVR = imOverlay(IMG, MASK);
%   OVR = imOverlay(IMG, MASK, COLOR);
%   OVR = imOverlay(IMG, MASK1, COLOR1, MASK2
    
function [dim, isColor, is3D] = computeImageInfo(img)
% Compute image size, and determines if image is 3D and/or color
% Returns the dimension of image witghout the color channel, and two binary
% flags indicating if image is color, and 3D.


% size of matlab matrix
dim0    = size(img);

% detect 3D and color image
if length(dim0)==2
    % Default case: planar grayscale image
    dim     = dim0(1:2);
    isColor = false;
    is3D    = false;
    
elseif length(dim0)==3
    % either 3D grayscale, or planar color image
    if dim0(3)==3
        % third dimension equals 3 ==> color image
        dim     = dim0(1:2);
        isColor = true;
        is3D    = false;
    else
        % third dimension <> 3 ==> gray-scale 3D image
        dim     = dim0;
        isColor = false;
        is3D    = true;
    end