title: Applying Affine transform on an image using dlib
body: <p>I am looking to align two face images using the 68 landmarks learnt by the dlib detector. I know I can convert the images to OpenCV Mat and then use the <code>warpAffine</code> method. I am having certain memory leaks with it and decided to see if using only dlib is possible. I noticed that the dlib library has some methods in <code>geometry.h</code> for this purpose. </p>
  
  <p>For this, I am using <code>find_affine_transform</code> method to get a <code>point_transform_affine</code> object where I find the affine transformation between 3 points obtained using the shape and template. In the documentation, it is written that we can use this object to apply the transformation on vector of points. However, I have been unable to find some example for it.</p>
  
  <ol>
  <li>Could you tell me how I can apply the transformation learnt ?</li>
  <li>Secondly, I have an image loaded in array2d object. Is there a way to go from array2d to vector of points ?</li>
  </ol>
  
  <p>Some initial code is listed down below for the find_affine_transform. </p>
  
  <pre><code>std::vector&lt;dlib::vector&lt;double,2&gt;&gt; TemplateLandmarks;
  std::vector&lt;dlib::vector&lt;double,2&gt;&gt; ObtainedLandmarks;
  // push_back the specific coordinates in the above vectors
  
  array2d&lt;bgr_pixel&gt; img; 
  // read the image from a file path using load_image
  
  //  learning the best transformation map
  point_transform_affine H = find_affine_transform ( ObtainedLandmarks , TemplateLandmarks );
  </code></pre>