# Compare vectors, photo mosaic

I’m trying to make a photo mosaic web application. I split the main picture in to a number of squares. I split this square up in to 9 squares (See picture) Then I calculate the mean color (RGB) of the entire square and the mean color of the 9 little squares. So I will get the following vector.

Vector: Mean R; mean G; mean B; cell 1 R; cell 1 G; cell 1 B; cell 2 R; cell 2 G; cell 2 B; cell 3 R; cell 3 G; cell 3 B; cell 4 R; cell 4 G; cell 4 B; cell 5 R; cell 5 G; cell 5 B; cell 6 R; cell 6 G; cell 6 B; cell 7 R; cell 7 G; cell 7 B; cell 8 R; cell 8 G; cell 8 B; cell 9 R; cell 9 G; cell 9 B

This will all be number between 0 and 255. And the mean RGB is more important than the other elements.

I make the same vector for all pictures in my DB. So now I want to compare a square of the original too my DB and want to find the 10 closest pictures.

My question is how do I compare these vectors??

-
Maybe this helps: drdobbs.com/understanding-photomosaics/184404848?pgno=1 – Simon S Jan 3 '13 at 0:59