Error using reshape To RESHAPE the number of elements must not change. Error in load_database (line 17) v(:,(i-1)*10+j)=reshape(a,size(a,1)*size(a,2),1); Error in official (line 75) number = libCheck(load_database(5),imread('test2.b
1 回表示 (過去 30 日間)
古いコメントを表示
if(isempty(loaded)) v=zeros(10304,10*n); for i=1:n cd(strcat('C:\Users\123\Videos\matlabFaceRecognitionRealTime-master\matlabFaceRecognitionRealTime-master\S',num2str(i))); % disp(i); for j=1:10 disp(j) a=imread(strcat(num2str(j),'.bmp')); v(:,(i-1)*10+j)=reshape(a,size(a,1)*size(a,2),1); end cd .. end w=uint8(v); % Convert to unsigned 8 bit numbers to save memory. end %loaded=1; % Set 'loaded' to aviod loading the database again. out=w;
0 件のコメント
回答 (2 件)
KSSV
2016 年 11 月 9 日
編集済み: KSSV
2016 年 11 月 9 日
Your a after reading the image is a 3D matrix. Say of size (m,n,3). In reshape you are using reshape(a,size(a,1)*size(a,2),1), this means you are suing only m*n numbers. Rest of the numbers (2*m*n) are missed, there fore this problem is arising. You have to see to it that a is a 2D matrix.
Either convert your image to gray or use a = a(:,:,1) ;
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!