Question

I have seen a couple of images where they generally make a face out of numerous smaller images.

For example, say they tile 100 images in 10x10 grid, and somehow they vary hue/sat/col of the smaller images so that when you see the Big Picture, you see another image.

The question boils down to - say you have an image. What kind of algorithm would you apply to that image so that the average RGB value of that image is the one you have defined?

Was it helpful?

Solution

  1. Calculate the hue/sat/value of every tile (use HSV because smaller differences here seem more "natural" to the human eye than in RGB space)
  2. Now calculate the same values for each n*n tile of your big picture
  3. Find the tiles with the closest HSV values (minimum of sqrt((h1-h2)^2 - (s1-s2)^2 - (v1-v2)^)) and stamp that tile scaled down to n*n into the result.

To find the HSV for a tile, it should be enough to sum up all RGB values and then divide them by the number of pixels and convert that final RGB triple into HSV. But to be save, I suggest that you try that both versions.

See which Wikipedia article for RGB <-> HSV conversions.

To refine the algorithm, you can split every tile into an mm and calculate the average HSV for each grid element. Then, when you look for a match, divide the big image into as usual but also calculate mm HSV values. Select which tile matches most of these m*m best. This allows the algorithm to select tiles which have the same structure as the big picture.

For that extra touch, try to create a gigapixel image.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top