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: kaleidoscope_demo.m
    path of file: ./repos/mexopencv/samples
    
    the code of the file until where you have to start completion: %% Kaleidoscopic Reflections
%
% Inspired by:
% <
    
function out = image_crop(img, mask)
    if true
        out = cv.copyTo(img, 'Mask',mask);
    elseif true
        out = cv.bitwise_and(img, uint8(255), 'Mask',mask);
    else
        out = bsxfun(@times, img, uint8(mask~=0));
    end