Effacer les filtres
Effacer les filtres

How to store the matrix of an image in an excel sheet?

1 vue (au cours des 30 derniers jours)
Shreya Shetty
Shreya Shetty le 23 Juil 2019
Image is present in a folder. I want to store is matrix in an excel sheet. How to proceed?

Réponse acceptée

Shreya Shetty
Shreya Shetty le 26 Juil 2019
Image is 2d but each component has X,y,depth. So we extract RGB features.Select an image, Extract the RGB components, Save them in a single excel sheet whose name is user defined. Display original image, All-Black and colour versions of RGB components and retreived image from RGB components
[filename,filepath]=uigetfile({'*.jpg'}, 'Select an Image'); imdata= imread(strcat(filepath,filename)); RC=imdata(:,:,1); GC=imdata(:,:,2); BC=imdata(:,:,3); a=zeros(size(imdata, 1), size(imdata, 2)); just_red=cat(3, RC, a, a); just_green=cat(3, a, GC, a); just_blue=cat(3, a, a, BC); figure subplot(5,5,3); imshow(imdata) title('original image') subplot(5,5,7); imshow(RC) subplot(5,5,12); imshow(just_red) title('red channel') subplot(5,5,8); imshow(GC) subplot(5,5,13); imshow(just_green) title('green channel') subplot(5,5,9); imshow(BC) subplot(5,5,14); imshow(just_blue) title('blue channel') im=cat(3,just_red,just_green,just_blue); img=cat(3,RC,GC,BC); subplot(5,5,18); isequal(imdata,img) imshow(img) title('retreived image') [file,Path]=uiputfile('*.xlsx','Save image matrix as'); file=fullfile(Path,file); xlswrite(file,RC,'A1:GR200'); xlswrite(file,GC,'A201:GR400'); xlswrite(file,BC,'A401:GR600');

Plus de réponses (1)

Shreya Shetty
Shreya Shetty le 26 Juil 2019
Make changes as per requirement

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by