wfusmat
Fusion of two matrices or arrays
Description
Examples
Matrix Fusion
Create two matrices.
m1 = reshape(1:2:32,4,4)
m1 = 4×4
1 9 17 25
3 11 19 27
5 13 21 29
7 15 23 31
m2 = reshape(2:2:33,4,4)
m2 = 4×4
2 10 18 26
4 12 20 28
6 14 22 30
8 16 24 32
Fuse m1
and m2
using the mean
fusion method.
c1 = wfusmat(m1,m2,'mean')
c1 = 4×4
1.5000 9.5000 17.5000 25.5000
3.5000 11.5000 19.5000 27.5000
5.5000 13.5000 21.5000 29.5000
7.5000 15.5000 23.5000 31.5000
Fuse m1
and m2
using the rand
fusion method. Obtain the Boolean matrix. The nonzero entries of the Boolean matrix correspond to the values of m1
in the fused output. For reproducibility, set the random seed to the default value.
rng default [c2,d2] = wfusmat(m1,m2,'rand')
c2 = 4×4
2 10 18 26
4 11 20 27
5 13 21 30
8 16 24 31
d2 = 4x4 logical array
0 0 0 0
0 1 0 1
1 1 1 0
0 0 0 1
Fuse m1
and m2
using the UD_fusion
method. Confirm the first row of c3
equals the first row in m1
, and the last row in c3
equals the last row in m2
.
mtd = struct('name','UD_fusion','param',0.4); c3 = wfusmat(m1,m2,mtd)
c3 = 4×4
1.0000 9.0000 17.0000 25.0000
3.6444 11.6444 19.6444 27.6444
5.8503 13.8503 21.8503 29.8503
8.0000 16.0000 24.0000 32.0000
Input Arguments
A,B
— Input data
array
Input data to merge, specified as two arrays. The
inputs A
and B
must be the same size.
If A
and B
represent indexed images, then they are
M-by-N
matrices. If A
and
B
represent truecolor images,
then they are
M-by-N-by-3
arrays.
method
— Fusion method
'max'
| 'min'
| 'mean'
| 'img1'
| 'img2'
| 'rand'
| structure array
Fusion method, specified either as a structure array
or as one of the values listed here. For some fusion
methods, the wfusmat
function
creates a Boolean matrix
D
.
meth | Description |
---|---|
'max' |
|
'min' |
|
'mean' |
|
'img1' | C = A |
'img2' | C = B |
'rand' | C = A(D) + B(~D) ;
D is a Boolean random
matrix |
When specified as a structure array, the structure has
the form
struct('name',nameMETH,'param',paramMETH)
,
where nameMETH
can be one of the
values listed here.
nameMETH | Description |
---|---|
'linear' |
|
'UD_fusion' | Up-down fusion, with
x = linspace(0,1,size(A,1)); P = x.^paramMETH; C is computed
withC(i,:) = A(i,:)*(1-P(i)) + B(i,:)*P(i); C(1,:) = A(1,:) , and
C(end,:) =
B(end,:) |
'DU_fusion' | Down-up fusion |
'LR_fusion' | Left-right fusion (column-wise fusion) |
'RL_fusion' | Right-left fusion (column-wise fusion) |
'UserDEF' | User-defined fusion,
paramMETH is a character vector
or string scalar 'userFUNCTION'
containing a function name such that C =
userFUNCTION(A,B) . |
Output Arguments
C
— Fused output
array
Fused output of A
and
B
, returned as an array.
D
— Boolean matrix
matrix
Boolean matrix. For some fusion methods, the
wfusmat
function creates the
Boolean matrix. Otherwise, D is an empty matrix. For
more information, see
method
.
Version History
Introduced before R2006a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)