How this PCA code written here .can someone plz explain.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Im adding this PCA function into DWTPCAv code but i dont undrstand what is happening with this code.here ca is the dwt coefficient plzz help
[ca{i},ch{i},cv{i},cd{i}] = dwt2(a{i},'db3');
[fca m1]=fuse_pcaany(ca,n);
function [y1 a1] = fuse_pcaany(ca,n)
for i=1:1:n
M(:,i)=ca{i}(:);
end
[V, D] = eig(cov(M));
[z1 s1] = size(D);
for i=1:1:s1
D1(i)=D(i,i);
end
D2=max(D1(i));
for i=1:1:s1
if D1(i)==D2;
a1 = V(:,i)./sum(V(:,i));
end
end
[z2 s2]=size(ca{1});
% and fuse
y1=zeros(z2,s2);
for i=1:1:n
y = a1(i)*ca{i};
y1=y1+y;
end
0 Kommentare
Antworten (1)
Amish
am 8 Okt. 2024
Hi Praveen,
It seemsl like you are trying to understand how the above-mentioned code is functioning. It looks like the code snippet that you have provided is part of a larger process to perform Discrete Wavelet Transform (DWT) and Principal Component Analysis (PCA) based image fusion.
The function function "[y1 a1] = fuse_pcaany(ca, n)", constructs a matrix "M" where each column is a vectorized form of the approximation coefficients from each image. "eig" computes the eigenvectors V and eigenvalues D of the covariance matrixof M.
Then the vector 'a1' is found using maximum eigen values(D2) and its corresponding vector 'v' from the diagonal values of 'D'. The final loop does the fusion by adding weighted approximation coefficients from each image to "y1" using the previously calculated weights "a1".
To summarize, the DWT is used to get wavelet coefficients out of the images which is then used with PCA to find the most significant coefficients to fuse these components across multiple images using the PCA-derived weights.
The documentation for the eig and cov functions can be referred here:
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!