Unable to perform assignment because the size of the left side is 625-by-1 and the size of the right side is 1875-by-1

1 vue (au cours des 30 derniers jours)
circle_folder = 'C:\Users\MyPC\Documents\CR\start\circle';
name_circle = dir(fullfile(circle_folder, '*.png'));
total_circle = numel(name_circle);
rez_circle = [25 25];
m_circle = zeros(25*25, 5);
for n_circle = 1:total_circle
full_circle = fullfile(circle_folder, name_circle(n_circle).name);
images_circle = imread(full_circle);
images_circle = imresize(images_circle, rez_circle);
store_circle = imbinarize(images_circle);
store_circle = store_circle(:);
m_circle(:, n_circle) = store_circle;
figure(n_circle);
imshow(m_circle);
end
I'm trying to pull images from the folder in question, resize them to 25 by 25 pixels, then turn them into a binary matrix. The code works until the point i attempt to fit the images into said matrix. If I make the matrix bigger, so it becomes 1875-by-1, it works, however, I do need the matrix to be of this size.

Réponses (2)

KSSV
KSSV le 15 Juin 2022
Better save them into an cell array.
circle_folder = 'C:\Users\MyPC\Documents\CR\start\circle';
name_circle = dir(fullfile(circle_folder, '*.png'));
total_circle = numel(name_circle);
rez_circle = [25 25];
m_circle = cell(total_circle,1);
for n_circle = 1:total_circle
full_circle = fullfile(circle_folder, name_circle(n_circle).name);
images_circle = imread(full_circle);
images_circle = imresize(images_circle, rez_circle);
store_circle = imbinarize(images_circle);
store_circle = store_circle(:);
m_circle{n_circle} = store_circle;
figure(n_circle);
imshow(m_circle{n_circle}); %
end

Walter Roberson
Walter Roberson le 15 Juin 2022
One or more of your images are rgb. 25*25*3 = 1875

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by