how to convert gray image pixel values into text file

clc;
clear;
close all;
x=imread('lena512.bmp');
this is code i want this image as 512*512 pixcels matrix as is in text file how thsi is possible....?

3 件のコメント

krishna kotha
krishna kotha 2020 年 5 月 24 日
編集済み: krishna kotha 2020 年 5 月 24 日
clear;
close all;
x=imread('lena512.bmp');
rgbImage = x;
[rows, columns, numberOfColorChannels] = size(rgbImage)
fid = fopen('datat1.txt', 'wt');
for col = 1 : columns
for row = 1 : rows
fprintf(fid, '%d, %d = (%d, %d, %d)\n', ...
row, col, ...
rgbImage(row, col, 1));
end
end
but i need exact colomn and row wise
and iam getting like this
Rithvik Jonna
Rithvik Jonna 2020 年 5 月 24 日
編集済み: Rithvik Jonna 2020 年 5 月 24 日
Please use xlswrite function and turn to excel then you can use excel to text file
xlswrite('Image.xls',Image);
krishna kotha
krishna kotha 2020 年 5 月 24 日
i tried it but pixcel values jumping iam not getting exact 512*512 matrx

サインインしてコメントする。

回答 (0 件)

質問済み:

2020 年 5 月 24 日

コメント済み:

2020 年 5 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by