Cell from Unint8 Conversion error
4 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!