Error using reshape syntax
8 ビュー (過去 30 日間)
古いコメントを表示
I'm new in Matlab. I want to reduce the size of the vector magnitude to smaller so that later I can use it for the KNN classification. So I try use 'reshape' to reduce the vector column size to 100
Error using reshape
To RESHAPE the number of elements must not change.
Error in Gabor2 (line 25)
rs = reshape(mag,1,250*250);
Here is my code..
%Pelatihan (Training)
folder_citra = 'data latih';
nama_citra = dir(fullfile(folder_citra, '*.jpg'));
jumlah_citra = numel(nama_citra);
for n = 1:jumlah_citra
% Membaca citra
Img = imread(fullfile(folder_citra, nama_citra(n).name));
% Resize citra
Img_resize = imresize(Img, [250 250]);
% Konversi citra RGB menjadi Grayscale
Img_gray = rgb2gray(Img_resize);
% Ekstraksi Ciri Tekstur Filter Gabor
wavelength = 4;
orientation = 90;
[mag,phase] = imgaborfilt(gray, wavelength, orientation);
rs = reshape(mag,1,250*250);
mag_kecil = imresize(mag,1/25);
training = reshape(mag_kecil,1,100);
end
0 件のコメント
採用された回答
Walter Roberson
2019 年 4 月 4 日
reshape() can never be used to make an array smaller. It can only be used to change how a block of memory is indexed, with the number of elements having to stay the same.
You might be able to use resample() for your purposes.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!