title: Antipole Clustering
body: <p>I made a photo mosaic script (PHP). This script has one picture and changes it to a photo buildup of little pictures. From a distance it looks like the real picture, when you move closer you see it are all little pictures. I take a square of a fixed number of pixels and determine the average color of that square. Then I compare this with my database which contains the average color of a couple thousand of pictures. I determine the color distance with all available images. But to run this script fully it takes a couple of minutes.</p>
  
  <p>The bottleneck is matching the best picture with a part of the main picture. I have been searching online how to reduce this and came a cross “Antipole Clustering.” Of course I tried to find some information on how to use this method myself but I can’t seem to figure out what to do.</p>
  
  <p>There are two steps. 1. Database acquisition and 2. Photomosaic creation.
  Let’s start with step one, when this is all clear. Maybe I understand step 2 myself.</p>
  
  <p>Step 1:</p>
  
  <ul>
  <li><p>partition each image of the database into 9 equal rectangles arranged in a 3x3 grid</p></li>
  <li><p>compute the RGB mean values for each rectangle</p></li>
  <li><p>construct a vector x composed by 27 components (three RGB components for each rectangle)</p></li>
  <li><p>x is the feature vector of the image in the data structure</p></li>
  </ul>
  
  <p>Well, point 1 and 2 are easy but what should I do at point 3. How do I compose a vector X out of the 27 components (9 * R mean, G mean, B mean.) </p>
  
  <p>And when I succeed to compose the vector, what is the next step I should do with this vector.</p>
  
  <p>Peter</p>