Effacer les filtres
Effacer les filtres

Error using reshape To RESHAPE the number of elements must not change. Error in load_database (line 17) v(:,(i-1)*​10+j)=resh​ape(a,size​(a,1)*size​(a,2),1); Error in official (line 75) number = libCheck(l​oad_databa​se(5),imre​ad('test2.​b

1 vue (au cours des 30 derniers jours)
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;

Réponses (2)

Walter Roberson
Walter Roberson le 9 Nov 2016
The code expects the image to be grayscale but it is RGB
  2 commentaires
waqas siddiqui
waqas siddiqui le 9 Nov 2016
matchPic = imcropPolygon(bboxPolygon,videoFrame);
matchPic = cutPic(matchPic);
imwrite(matchPic,'test2.bmp','bmp');
%load database at the beginning
number = libCheck(load_database(5),imread('test2.bmp'));
this is the code

Connectez-vous pour commenter.


KSSV
KSSV le 9 Nov 2016
Modifié(e) : KSSV le 9 Nov 2016
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) ;

Community Treasure Hunt

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

Start Hunting!

Translated by