Mentions légales du service

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

Added parameter to specify bit depth

parent 179ee022
Branches FDL
No related tags found
No related merge requests found
......@@ -2,22 +2,25 @@ function frames = convert(frames,varargin)
%CONVERT Summary of this function goes here
% Detailed explanation goes here
[~,defBitDepth] = utils.precision(class(frames{1}));
p = inputParser; p.StructExpand = true; p.KeepUnmatched = true;
p.addOptional('outColSpace' , 'ycbcr' , @ischar);
p.addOptional( 'inColSpace' , 'rgb' , @ischar);
p.addOptional( 'bitDepth' , defBitDepth , @isnumeric);
p.parse(varargin{:});
inColSpace = p.Results.inColSpace;
outColSpace = p.Results.outColSpace;
bitDepth = p.Results.bitDepth;
imgSize = ndims(frames{1});
switch imgSize
case 3
if (strcmp(inColSpace,'rgb') && strcmp(outColSpace,'ycbcr'))
frames = cellfun(@utils.rgb2ycbcr,frames,'UniformOutput',false);
frames = cellfun(@(f) utils.rgb2ycbcr(f,bitDepth),frames,'UniformOutput',false);
elseif (strcmp(inColSpace,'ycbcr') && strcmp(outColSpace,'rgb'))
frames = cellfun(@utils.ycbcr2rgb,frames,'UniformOutput',false);
frames = cellfun(@(f) utils.ycbcr2rgb(f,bitDepth),frames,'UniformOutput',false);
end
case 2
warning('Monochrome image, no conversion');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment