-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmergech.m
50 lines (43 loc) · 951 Bytes
/
mergech.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function C = merge2ch(a, ch1, ch2, varargin)
%
% merge2ch(a, ch1, ch2)
% merge2ch(a, ch1, ch2, fraction)
% merge2ch(a, ch1, ch2, fraction1, fraction1)
%
%
% merge 2 images [row col ch] into composite image
%
fraction = 0.5;
switch ndims(a)
case 2
a = a;
disp('fn: mergech: A is just 2-D image. ch_a was ignored.');
case 3
a = comp(a, ch1);
otherwise
disp('wrong input to function imgmerge');
end
nVarargs = length(varargin);
switch ndims(ch2)
case 1
B = comp(a, ch2);
if nVarargs>=1
fraction = varargin{1};
end
case 2
B = ch2;
if nVarargs>=1
fraction = varargin{1};
end
case 3
if nVararg==1
B = comp(ch2, varargin{1});
end
if nVarargs>=2
fraction = varargin{2};
end
otherwise
disp('wrong input to function imgmerge');
end
merge(a,B,fraction);
end