Index exceeds matrix dimensions.
1 次查看(过去 30 天)
显示 更早的评论
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.
采纳的回答
Image Analyst
2014-1-22
Rows is the first index, columns is the second. You had them swapped when you did this:
croped=a(1:119,1:116,:); % col, row instead of row, col like it should be
In addition, you can read about the size function in Steve's blog http://blogs.mathworks.com/steve/2011/03/22/too-much-information-about-the-size-function/, which essentially say what Jan said.
0 个评论
更多回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!