Index exceeds matrix dimensions.
Afficher commentaires plus anciens
Dear All,
Good Day to you.I am trying to crop an image using the following method.I want to subdivide an image into components.My code is as follows.| |
a=imread('E:\a1.jpg'); [col row]=size(a); col
col =
119
row
row =
345
croped=a(1:119,1:116,:);
- _??? Index exceeds matrix dimensions.
I get an error message shown above, when try to crop using the above values.And error message is not there for certain values. Please help me to solve this.
Thanks in advance.
1 commentaire
Mischa Kim
le 21 Jan 2014
Good one. Could you attach the jpg?
Réponse acceptée
Plus de réponses (2)
pushk dfd
le 5 Fév 2014
1 vote
What do you get for:
[col, row, channel] = size(a)
If you specify less outputs than the array has, the last one is the product of the remaining dimensions. If a is an RGB image, its dimensions are:
[119 x 115 x 3]
Therefore [s1,s2] = size(a) replies s1=119, s2=115*3.
2 commentaires
Koteswar Rao Jerripothula
le 22 Jan 2014
good observation, thanks
pushk dfd
le 5 Fév 2014
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!