source: trunk/src/transform_field/ima_ratio.m @ 819

Last change on this file since 819 was 810, checked in by g7moreau, 10 years ago
  • Add license
File size: 2.1 KB
Line 
1%'ima_ratio': take the ratio of two input images with same size
2%
3% the two fields are subtstracted when of the same nature (scalar or
4% vector), if the coordinates do not coincide, the second field is
5% interpolated on the cooridintes of the first one
6%
7% when scalar and vectors are combined, the fields are just merged in a single matlab structure for common visualisation
8%-----------------------------------------------------------------------
9% function SubData=sub_field(Field,XmlData,Field_1)
10%
11% OUPUT:
12% SubData: structure representing the resulting field
13%
14% INPUT:
15% Field: matlab structure representing the first field
16% XmlData: input calibration parameter, not used
17% Field_1:matlab structure representing the second field
18
19%=======================================================================
20% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
21%   http://www.legi.grenoble-inp.fr
22%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
23%
24%     This file is part of the toolbox UVMAT.
25%
26%     UVMAT is free software; you can redistribute it and/or modify
27%     it under the terms of the GNU General Public License as published
28%     by the Free Software Foundation; either version 2 of the license,
29%     or (at your option) any later version.
30%
31%     UVMAT is distributed in the hope that it will be useful,
32%     but WITHOUT ANY WARRANTY; without even the implied warranty of
33%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34%     GNU General Public License (see LICENSE.txt) for more details.
35%=======================================================================
36
37function DataOut=ima_ratio(DataIn,XmlData,DataIn_1)
38
39%% option to introduce input parameters when function is selected, skipped here
40DataOut=DataIn;
41if ~isstruct(DataOut)
42%     if ~isfield(DataIn,'A')
43%         msgbox_uvmat('ERROR','ima_ratio requires two images of the same size as input')
44    return
45    end
46
47
48%% actual calculation
49if exist('DataIn_1','var')
50    DataIn_1.A(DataIn_1.A==0)=1;
51    DataOut.A=double(DataIn.A)./double(DataIn_1.A);
52end
Note: See TracBrowser for help on using the repository browser.