% 'ima_color2BW': transform a color image to grey scale image %------------------------------------------------------------------------ %%%% Use the general syntax for transform fields with a single input %%%% % OUTPUT: % DataOut: output field structure % %INPUT: % DataIn: first input field structure %======================================================================= % Copyright 2008-2019, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France % http://www.legi.grenoble-inp.fr % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr % % This file is part of the toolbox UVMAT. % % UVMAT is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published % by the Free Software Foundation; either version 2 of the license, % or (at your option) any later version. % % UVMAT is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License (see LICENSE.txt) for more details. %======================================================================= function DataOut=ima_color2BW(DataIn,XmlData) DataOut=[]; if isfield(DataIn,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0) return end DataOut=DataIn; %default if ndims(DataOut.A)==3 DataOut.A=uint16(sum(double(DataOut.A),3));%sum on color components, transform in 16 bit BW images end