位置 1 のインデックスが無効です。配列インデックスは正の整数または logical 値でなければなりません。
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
% 画像が格納されているフォルダのパス
folderPath = 'minikadid';
% フォルダ内の画像ファイルの一覧を取得
fileList = dir(fullfile(folderPath, '*.png')); % 画像ファイルの拡張子に合わせて変更
% CSVファイルのパス
%csvFilePath = fullfile(folderPath, 'ssim_values.csv');
csvFilePath = 'ssim_values.csv';
% ファイルを開いてヘッダーを書き込み
csvFile = fopen(csvFilePath, 'w');
fprintf(csvFile, 'Image,SSIM value\n');
% 画像ごとにSSIM値を計算し表示
for i = 1:length(fileList)
if rem(i, 5) == 1
% 参照画像の指定(変更)
imagePath = fullfile(folderPath, fileList(i).name);
refImage = imread(imagePath);
end
% 画像の読み込み
imagePath = fullfile(folderPath, fileList(i).name);
image = imread(imagePath);
% SSIM値の計算
ssimValue = ssim(image, refImage);
% CSVファイルに書き込み
fprintf(csvFile, '%s,%f\n', fileList(i).name, ssimValue);
end
% ファイルを閉じる
fclose(csvFile);
上記のコードで、「SSIM値の計算」とコメントアウトされている部分のコードが「位置 1 のインデックスが無効です。配列インデックスは正の整数または logical 値でなければなりません。」というエラーが出てしまいます。なぜでしょうか?以前は同じコードで動いていたはずなんですが、、、
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Display Point Clouds dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!