Borrar filtros
Borrar filtros

処理をして得られたデ​ータを表にして、エク​セルに出力する方法

6 visualizaciones (últimos 30 días)
suzuka iwaki
suzuka iwaki el 27 de Oct. de 2023
Respondida: Dyuman Joshi el 27 de Oct. de 2023
jpegFiles = dir('*.jpg');
numfiles = 162;
mydata = cell(1, numfiles);
for k = 1:numfiles
mydata{k} = imread(jpegFiles(k).name);
RGB = imread(jpegFiles(k).name);
I = im2gray(RGB);
graying = rgb2gray(RGB);
meanLuminance = mean(graying,"all"); % RGBをグレースケールに変換したときの平均輝度
end
1行目に、番号、平均輝度のラベルを含ませた、163行2列の表で表したいと考えています。分からない点が2つあり、上のコードで得られた、変数である平均輝度をデータセットとしてテーブルに読み込む方法と、1から162番までの162行をいかにして作るかというところです。よろしくお願いします。

Respuestas (1)

Dyuman Joshi
Dyuman Joshi el 27 de Oct. de 2023
From what I understood -
jpegFiles = dir('*.jpg');
numfiles = 162;
mydata = cell(1, numfiles);
%Preallocate a table
T = table((1:162)', zeros(162,1), 'VariableNames', {'Serial_No.', 'Average_Luminance_Value'})
for k = 1:numfiles
mydata{k} = imread(jpegFiles(k).name);
RGB = imread(jpegFiles(k).name);
%I = im2gray(RGB);
graying = rgb2gray(RGB);
meanLuminance = mean(graying,"all"); % RGBをグレースケールに変換したときの平均輝度
T{k,2} = meanLuminance;
end

Categorías

Más información sobre table en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!