How to solve "Error using ' Transpose on ND array is not defined. Use PERMUTE instead." ?
古いコメントを表示
i have convert image from rgb to gray using this code :
axes(handles.axes3)
cropface=imcrop(X,face);
newsize=imresize(cropface,[151 151]);
grayscale=rgb2gray(newsize);
and then i save that image using this code :
img = getframe(gca);
[filename2,pathname2] = uiputfile(...
{'*.jpg','jpeg image(*.jpg)';
'*.*','All file(*.*)'},...
'Save Image','H:\SKRIPSI\Citra Latih\');
imwrite(img.cdata,fullfile(pathname2,filename2));
then I intend to creating the image matrix X using grayscale image that I have and I save with the code above, use the following code:
X = [];
for i = 1 : imgcount
str = strcat(datapath,'\',int2str(i),'.jpg');
img = imread(str);
img = rgb2gray(img);
[r c] = size(img);
temp = reshape(img',r*c,1);
I want to ask is why should I rgbgray code reuse in the process of creating the image matrix X, whereas the image that I use have grayscale. when I remove the rgb2gray code, then I see an error like this:

採用された回答
その他の回答 (1 件)
David H
2016 年 6 月 13 日
0 投票
My guess is that your variable "img" has more than 2 dimensions. Identify which 2 dimensions of "img = imread(str);" are the ones you actually want.
2 件のコメント
Guillaume
2016 年 6 月 13 日
It's not a guess! a rgb image always have three dimensions.
Alvindra Pratama
2016 年 6 月 16 日
カテゴリ
ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!