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: drawContours.m
    path of file: ./repos/mexopencv/+cv
    
    the code of the file until where you have to start completion: %DRAWCONTOURS  Draws contours outlines or filled contours
%
%     im = cv.drawContours(im, contours)
%     im = cv.drawContours(im, contours, 'OptionName', optionValue, ...)
%
% ## Input
% * __im__ Image on which to draw contours.
% * __contours__ All the input contours. Each contour is stored as a 2D point
%   vector (integer points). A cell array of cell arrays of the form:
%   `{{[x,y],[x,y],...}, ...}`, or a cell array of Nx2 matrices.
%
% ## Output
% * __im__ Destination image, same size and type as input `im`.
%
% ## Options
% * __ContourIdx__ Parameter indicating a contour to draw. A zero-based index
%   in the range `[0,length(contours)-1]`. If it is negative, all the contours
%   are drawn. default -1
% * __Color__ Color of the contours. default is white color.
% * __Thickness__ Thickness of lines the contours are drawn with. If it is
%   negativ
    
function draws the contour(s)
%   and all the nested contours. If it is 2, the function draws the contours,
%   all the nested contours, all the nested-to-nested contours, and so on.
%   This parameter is only taken into account when there is `Hierarchy`
%   available. default `intmax('int32')`
% * __Offset__ Optional contour shift parameter. Shift all the drawn contours
%   by the specified `offset = (dx,dy)`. default [0,0]
%
% The function draws contour outlines in the image if `Thickness >= 0` or
% fills the area bounded by the contours if `Thickness < 0`.
%
% ## Example
% The example below shows how to retrieve connected components from a binary
% image and label them:
%
%     % binary (black-n-white) image
%     src = cv.imread('bw.png', 'Flags',0);
%     src = logical(src > 0);
%
%     [contours,hierarchy] = cv.findContours(src, 'Mode','CComp', ...
%         'Method','Simple');
%
%     % iterate through all the top-level contours,
%     % draw each connected component with its own random color
%     dst = zeros([size(src),3], 'uint8');
%     idx = 0;
%     while idx >= 0
%         color = randi([0 255], [1 3], 'uint8');
%         dst = cv.drawContours(dst, contours, 'ContourIdx',idx, ...
%             'Color',color, 'Thickness','Filled', 'LineType',8, ...
%             'Hierarchy',hierarchy);
%         idx = hierarchy{idx+1}(1);
%     end