function downloadTrainedLowLightRecoveryNet(url,destination)
% The downloadTrainedLowLightRecoveryNet function downloads the pretrained
% low-light camera pipeline network that recovers well-exposed images from
% underexposed images. 
%
% Copyright 2021 The MathWorks, Inc.

[~,name,~] = fileparts(url);
netDirFullPath = destination;
netZipFileFullPath = fullfile(destination,[name+".zip"]);
netMATFileFullPath = fullfile(destination,[name+".mat"]);
if ~exist(netMATFileFullPath,"file")
    if ~exist(netZipFileFullPath,"file")
        disp("Downloading pretrained low-light recovery network for Sony See-In-The-Dark data.");
        disp("This can take several minutes to download...");
        if ~exist(netDirFullPath,"dir")
            mkdir(netDirFullPath);
        end
        websave(netZipFileFullPath,url);
        disp("Done.");
    end
    unzip(netZipFileFullPath,netDirFullPath)
else
    disp("Pretrained low-light recovery network for the Sony See-In-The-Dark data set already exists.");
end
end