sa Zas
sa Zas

Reputation: 49

Matlab size of image (x,y)

why when I used size function in Matlab for my image the result was ans = 600 800 but my real image size = (800, 600)?

Upvotes: 0

Views: 1186

Answers (1)

Bull
Bull

Reputation: 11941

This is because of difference in conventions. When we say an image is 800x600 we generally mean it 800 columns by 600 rows. However when Matlab reports the size of a matrix it does it using standard matrix indexing which is row then column. So size(A) = (800, 600) means that the image is 800 rows by 600 columns.

For example, for the following "2x4" image:

>> A = [1 2; 3 4; 5 6; 7 8]

A =

     1     2
     3     4
     5     6
     7     8

>> size(A)
ans =

     4     2

Upvotes: 3

Related Questions