Cell from Unint8 Conversion error

3 ビュー (過去 30 日間)
Ashutosh Desai
Ashutosh Desai 2020 年 7 月 10 日
コメント済み: Ashutosh Desai 2020 年 7 月 18 日
clc;
clear all;
close all;
A_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\A\*.png');
B_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\B\*.png');
C_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\C\*.png');
D_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\D\*.png');
E_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\E\*.png');
A_result=cellmat(1,length(A_folder),32,32);
B_result=cellmat(1,length(B_folder),32,32);
C_result=cellmat(1,length(C_folder),32,32);
D_result=cellmat(1,length(D_folder),32,32);
E_result=cellmat(1,length(E_folder),32,32);
m=100;
for i=1:m
A_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\A\',A_folder(i).name));
B_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\B\',B_folder(i).name));
C_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\C\',C_folder(i).name));
D_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\D\',D_folder(i).name));
E_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\E\',E_folder(i).name));
end
My database contains 100 greyscale images. I need to convert them into matrices with each cell containing a matrice of uint8 form of each image.

採用された回答

Srivardhan Gadila
Srivardhan Gadila 2020 年 7 月 15 日
In the above code, index the Cell Array with with Curly Braces, {} & not Smooth Parentheses, () in the for loop ie., change the code in the for loop to:
for i=1:m
A_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\A\',A_folder(i).name));
B_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\B\',B_folder(i).name));
C_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\C\',C_folder(i).name));
D_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\D\',D_folder(i).name));
E_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\E\',E_folder(i).name));
end
  1 件のコメント
Ashutosh Desai
Ashutosh Desai 2020 年 7 月 18 日
Works. Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by