Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d51c5e64 authored by DIB Elian's avatar DIB Elian
Browse files

Moved functions from +yuv to +utils

parent e49b1750
No related branches found
No related tags found
No related merge requests found
function [name,imgSize,imgRes,subSamp,bitDepth] = name2params(convname,ext)
%NAME2PARAMS Summary of this function goes here
% Detailed explanation goes here
convexpr = ['(?<name>\w+)_(?<imgRes>\d+x\d+)_(?<imgSize>\d+x\d+)_',...
'(?<subSamp>400|420|422|444)_(?<bitDepth>\d+)bit.',ext];
tokens = regexp(convname,convexpr,'names');
name = tokens.name;
imgSize = strsplit(tokens.imgSize,'x');
imgSize = cellfun(@str2double,imgSize);
imgSize = flip(imgSize);
imgRes = strsplit(tokens.imgRes,'x');
imgRes = cellfun(@str2double,imgRes);
subSamp = tokens.subSamp;
bitDepth = str2double(tokens.bitDepth);
switch subSamp
case '400'
imgSize = [imgSize,1];
otherwise
imgSize = [imgSize,3];
end
end
\ No newline at end of file
function convname = params2name(name,imgSize,imgRes,subSamp,bitDepth,ext)
%PARAMS2NAME Summary of this function goes here
% Detailed explanation goes here
imgSize = [num2str(imgSize(2)),'x',num2str(imgSize(1))];
imgRes = arrayfun(@num2str,imgRes,'UniformOutput',false);
imgRes = strjoin(imgRes,'x');
bitDepth = num2str(bitDepth);
convname = [strjoin({name,imgRes,imgSize,subSamp,bitDepth},'_'),['bit.',ext]];
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment