title: OpenCV marker tracking in iOS
body: <p>I am looking in to Augmented reality marker tracking and found a brilliant OpenCV example on github.</p>
  
  <p><a href="https://github.com/jorge-r-murillo-c/AR-IOs-marker-detector" rel="nofollow noreferrer">https://github.com/jorge-r-murillo-c/AR-IOs-marker-detector</a></p>
  
  <p>I believe I found the code that is translated in to the marker that its looking for</p>
  
  <pre><code>int Marker::hammDistMarker(cv::Mat bits)
  {
    int ids[4][5]=
    {
      {1,0,0,0,0},
      {1,0,1,1,1},
      {0,1,0,0,1},
      {0,1,1,1,0}
    };
  
    int dist=0;
  
    for (int y=0;y&lt;5;y++)
    {
      int minSum=1e5; //hamming distance to each possible word
  
      for (int p=0;p&lt;4;p++)
      {
        int sum=0;
        //now, count
        for (int x=0;x&lt;5;x++)
        {
          sum += bits.at&lt;uchar&gt;(y,x) == ids[p][x] ? 0 : 1;
        }
  
        if (minSum&gt;sum)
          minSum=sum;
      }
  
      //do the and
      dist += minSum;
    }
  
    return dist;
  }
  </code></pre>
  
  <p>However this has no correlation to the picture of the marker</p>
  
  <p><img src="https://i.stack.imgur.com/EAn6c.png" alt="enter image description here"></p>
  
  <p>I did look in the book that this code came from but it made no sense to me.</p>
  
  <p><a href="http://books.google.co.uk/books?id=UjWoIFHcr58C&amp;pg=PT119&amp;lpg=PT119&amp;dq=hammDistMarker&amp;source=bl&amp;ots=S8l0Frrx1A&amp;sig=4m9R7A-UJqk3WnfvOdKWYadZMbQ&amp;hl=en&amp;sa=X&amp;ei=IsfzUpu-Ia6e7Aaq6oDIDg&amp;ved=0CD0Q6AEwAg#v=onepage&amp;q=hammDistMarker&amp;f=false" rel="nofollow noreferrer">http://books.google.co.uk/books?id=UjWoIFHcr58C&amp;pg=PT119&amp;lpg=PT119&amp;dq=hammDistMarker&amp;source=bl&amp;ots=S8l0Frrx1A&amp;sig=4m9R7A-UJqk3WnfvOdKWYadZMbQ&amp;hl=en&amp;sa=X&amp;ei=IsfzUpu-Ia6e7Aaq6oDIDg&amp;ved=0CD0Q6AEwAg#v=onepage&amp;q=hammDistMarker&amp;f=false</a></p>
  
  <p>Is there a tool, process, function that would turn the image in to the tracking data or am I barking up the wrong tree?</p>