From ee1aac1105c375eddfb5d5b50684a7e13672e262 Mon Sep 17 00:00:00 2001 From: Elian Dib <elian.dib@inria.fr> Date: Tue, 27 Nov 2018 09:43:00 +0100 Subject: [PATCH] Added parameter to specify bit depth --- convert.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/convert.m b/convert.m index 9d8f055..d36a6a8 100644 --- a/convert.m +++ b/convert.m @@ -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'); -- GitLab