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: lap_pyr_demo_gui.m
    path of file: ./repos/mexopencv/samples
    
    the code of the file until where you have to start completion: %% Laplacian Pyramid Construction and Merging
%
% References:
%
% * Peter J. Burt and Edward H. Adelson,
%   "The Laplacian Pyramid as a Compact Image Code",
%   IEEE Trans. on Communications, vol. 31, no. 4, pages 532-540, 1983.
%   <http://citeseer
    
function levels = build_lap_pyr(img, nlevel, dtype)
    %BUILD_LAP_PYR  Build Laplacian pyramid
    %
    %     levels = build_lap_pyr(img, nlevel)
    %     levels = build_lap_pyr(img, nlevel, dtype)
    %
    % ## Input
    % * __img__ input image
    % * __nlevel__ number of pyramid levels
    % * __dtype__ precision for image arithmetics, default 'int16'
    %
    % ## Output
    % * __levels__ Laplacian pyramid, cell array of length `nlevel`
    %
    % See also: cv.buildPyramid, cv.Blend