필터 지우기
필터 지우기

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 (최근 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;

답변 (2개)

Walter Roberson
Walter Roberson 2016년 11월 9일
The code expects the image to be grayscale but it is RGB
  댓글 수: 2
waqas siddiqui
waqas siddiqui 2016년 11월 9일
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

댓글을 달려면 로그인하십시오.


KSSV
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) ;

Community Treasure Hunt

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

Start Hunting!

Translated by