source: trunk/src/transform_field/ima_color2BW.m @ 1062

Last change on this file since 1062 was 1061, checked in by g7moreau, 6 years ago
  • Update copyright to year 2019
File size: 1.5 KB
RevLine 
[823]1% 'ima_color2BW': transform a color image to grey scale image
2%------------------------------------------------------------------------
3%%%%  Use the general syntax for transform fields with a single input %%%%
4% OUTPUT:
5% DataOut:   output field structure
6%
7%INPUT:
8% DataIn:  first input field structure
9
10%=======================================================================
[1061]11% Copyright 2008-2019, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
[823]12%   http://www.legi.grenoble-inp.fr
13%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
14%
15%     This file is part of the toolbox UVMAT.
16%
17%     UVMAT is free software; you can redistribute it and/or modify
18%     it under the terms of the GNU General Public License as published
19%     by the Free Software Foundation; either version 2 of the license,
20%     or (at your option) any later version.
21%
22%     UVMAT is distributed in the hope that it will be useful,
23%     but WITHOUT ANY WARRANTY; without even the implied warranty of
24%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25%     GNU General Public License (see LICENSE.txt) for more details.
26%=======================================================================
27
[1057]28function DataOut=ima_color2BW(DataIn,XmlData)
29DataOut=[];
30if isfield(DataIn,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0)
31    return
32end
[823]33DataOut=DataIn; %default
34if ndims(DataOut.A)==3
[972]35    DataOut.A=uint16(sum(double(DataOut.A),3));%sum on color components, transform in 16 bit BW images
[823]36end
37 
Note: See TracBrowser for help on using the repository browser.