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: RemoveCRF.m
    path of file: ./repos/HDR_Toolbox/source_code/Generation/util
    
    the code of the file until where you have to start completion: function imgOut = RemoveCRF(img, lin_type, lin_fun)
%
%       imgOut = RemoveCRF(img, lin_type, lin_fun)
%
%       This function builds an HDR image from a stack of LDR images.
%           -imgOut: an image with values in [0,1]
%
%           -lin_type: the linearization function:
%                      - 'linear': images are already linear
%                      - 'gamma2.2': gamma function 2.2 is used for
%                                    linearization;
%                      - 'sRGB': images are encoded using sRGB
%                      - 'LUT': the lineraziation function is a look-up
%                               table defined stored as an array in the 
%                               lin_fun 
%                      - 'poly': the lineraziation function is a polynomial
%                               stored in lin_fun 
%
%           -lin_fun: it is the camera response function of the camera that
%           took the pictures in the stack. If it is empty, [], and 
%           type is 'LUT' it will be estimated using Debevec and Malik's

    
function imgOut = RemoveCRF(img, lin_type, lin_fun)
%
%       imgOut = RemoveCRF(img, lin_type, lin_fun)
%
%       This function builds an HDR image from a stack of LDR images.
%           -imgOut: an image with values in [0,1]
%
%           -lin_type: the linearization function:
%                      - 'linear': images are already linear
%                      - 'gamma2.2': gamma function 2.2 is used for
%                                    linearization;
%                      - 'sRGB': images are encoded using sRGB
%                      - 'LUT': the lineraziation function is a look-up
%                               table defined stored as an array in the 
%                               lin_fun 
%                      - 'poly': the lineraziation function is a polynomial
%                               stored in lin_fun 
%
%           -lin_fun: it is the camera response function of the camera that
%           took the pictures in the stack. If it is empty, [], and 
%           type is 'LUT' it will be estimated using Debevec and Malik's
%           method.
%
%        Output:
%           -imgOut: a linearized (CRF is removed) image.
%

%is the linearization type of the images defined?
if(~exist('lin_type', 'var'))
    lin_type = 'gamma';
end