I'm currently learning Matlab and having troubles understand the image section. I have this powerpoint slide about matlab image:
****Image Matrices*
3-layered image matrices -- Read 'rainbow.jpg' into im
Subset im to im2 – eg( 155:184 , 145:164, : )
*1 layer of an image – Get the red layer in im2****
I would like to ask what does(155:184, 145:164, :) represent? What does each value in parenthesis represent? Also, what does the semi-colon represent?
Thank you!
Say you have a 3 dimensional matrix A and you are indexing your matrix. I will use the example above:
A(155:184,145:164,:)
155:184
in the first entry means take rows 155 to 184 145:164
in the second entry means take columns 145 to 164 and the semi-colon in the last entry means take EVERY element along the 3rd dimension. So if you have 200x200x3
, the semi-colon will take the 3 arrays along that 3rd dimension.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.