PCA/ICA on grayscale image
22 ビュー (過去 30 日間)
古いコメントを表示
I have read some posts on here discussing how PCA can be applied to color images to separate features. I have also seen some comments asking why these techniques would even be applied to grayscale images in the first place. To answer that question for anyone willing to help me, I have the background and I have different levels of grayscale intensity. The images I am trying this technique on are from an electron microscope and cannot be taken in color. Without trying to be too technical on the physical science, the levels of intensity within the grayscale image come from different types of atoms from the object being imaged. In my case, I have Ce atoms and Pt atoms so there will be different levels of intensity coming from each element.
I have attached my attempt here. This code does extract some components, but I am not sure if they are even the correct ones. I also cannot plot these components in an image to see how well I separated each component. Any help in separating the different components would be greatly appreciated.
clear all
image = imread('HAADF _ ATT 1_12MX_200kV_3211.jpg');
image = double(image);
image_reshape = reshape(image, size(image,1)*size(image,2),3);
figure(1)
subplot(2,2,1)
imshow(image)
subplot(2,2,2)
imhist(image)
subplot(2,2,3)
imshow(image_reshape)
subplot(2,2,4)
imhist(image_reshape)
q = 2;
[coeff,Data_PCA,latent,tsquared,explained,mu] = pca(image_reshape);
md1 = rica(Data_PCA, q);
Data_ICA = transform(md1, Data_PCA);
Data_no_noise = Data_ICA(:,1);
plotsPerCol = 2;
figure(2)
for i = 1:q
subplot(plotsPerCol, ceil(q/plotsPerCol), i)
plot(Data_ICA(:,i).^2)
title(strcat("Component ", string(i), " Squared"))
end
figure(3)
PCA1 = Data_PCA(:,1).^2;
PCA2 = Data_PCA(:,2).^2;
PCA3 = Data_PCA(:,3).^2;
imshow(PCA1)
0 件のコメント
採用された回答
yanqi liu
2021 年 11 月 19 日
clc;clear all;close all;
image = imread('football.jpg');
image = double(image);
image_reshape = reshape(image, size(image,1)*size(image,2),3);
figure(1)
subplot(2,2,1)
imshow(mat2gray(image))
subplot(2,2,2)
imhist(mat2gray(image))
subplot(2,2,3)
plot3(image_reshape(:,1), image_reshape(:,2), image_reshape(:,3), 'r.')
subplot(2,2,4)
imhist(mat2gray(image_reshape))
q = 2;
[coeff,Data_PCA,latent,tsquared,explained,mu] = pca(image_reshape);
md1 = rica(Data_PCA, q);
Data_ICA = transform(md1, Data_PCA);
Data_no_noise = Data_ICA(:,1);
plotsPerCol = 2;
figure(2)
for i = 1:q
subplot(plotsPerCol, ceil(q/plotsPerCol), i)
plot(Data_ICA(:,i).^2)
title(strcat("Component ", string(i), " Squared"))
end
figure(3)
PCA1 = Data_PCA(:,1).^2;
PCA2 = Data_PCA(:,2).^2;
PCA3 = Data_PCA(:,3).^2;
plot3(PCA1, PCA2, PCA3, 'r.')
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!