Index exceeds matrix dimensions.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Taiwo
le 7 Juin 2014
Réponse apportée : Image Analyst
le 7 Juin 2014
I want to divide an image into 20 blocks, 2 vertically and 10 horizontally. And I wish to store the blocks in an array. But I have "?? Index exceeds matrix dimensions" error message anytime I try to run it. this is the code:
[x,y] = size(I);
x1 = mod(x,10);
y1 = mod(y,2);
x2 = x-x1;
y2 = y-y1;
NewI = resize(I, [x2,y2]);
[x3, y3] = size(NewI);
x4 = x3/10;
y4 = y3/2;
k=1;
for i = 1:x4:x3
for j = 1:y4:x3
subregion{k} = NewI(i:(i+(x4-1)), j:(j+(y4-1)));
k = k+1;
end
end
Thanks in anticipation
0 commentaires
Réponse acceptée
Image Analyst
le 7 Juin 2014
Two methods are shown in the FAQ. http://matlab.wikia.com/wiki/FAQ#How_do_I_split_an_image_into_non-overlapping_blocks.3F
Take your pick of which method you want to use.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!