# Is information lost when converting an image to a single vector for analysis?

On several tutorials on object and pattern recognition in images (such as the typical mnist digit recognition problem), when working with a sample of $m$ images of $n \times n$ pixels each, the first step is to build a matrix of $m \times (n * n)$, where each image is converted into a single row-vector with all of its pixels, one next to the other. Different techniques are then applied to this matrix, such as PCA.

My question is: when converting a two-dimensional image to a single-dimensional vector by placing each image row next to another, the fact of which pixels are neighbours (in the same column, different row) seems to be lost. For instance, in image:

a b c
d e f
g h i


Which is converted to:

a b c d e f g h i


The fact that b and e were next to each other seems to be lost.

Is that conclusion correct? Does that fact even matter for analysis? Are there other ways to represent the image that do preserve that piece of information?

Apologies in advance if the question is too vague or basic, I'll be glad to reformulate if needed. Thank you.

• A really nice question :) Updated it with the appropriate tag. Welcome to the site! Jan 27, 2016 at 16:02

So, information is there, but is encoded in another place, specifically in the transformation function. As a consequence, to learn also the position you have to create those new features to express that information. Not also that when you have a classical learner this information is not understood by learner. Take for example a linear model. There is no difference between $f_1 = \beta_0 +\beta_1 x_1 + \beta_2 x_2$ and $f_2 = \beta_2 x_2 + \beta_0 + \beta_1 x_1$. So learning with a simple linear model is impossible to use directly this locality information. This happens with most learners. So, even in the original space the locality is an information in your head, and not in the data.