title: How can I detect rotation angle between 2 images in C#?
body: <p>I have 2 images, one is the original image which has grids in it, the other is the same image except it has digits written in those grids, and is rotated, I am supposed to find the rotation angle for that image so that I can make it straight and recognize those digits written.</p>
  
  <p>For the digits I'd probably put them in 2D pixel arrays and see the patterns, but I can't really understand how to write the code to detect the rotation angle. This has been answered here <a href="https://stackoverflow.com/questions/23619269/calculating-translation-value-and-rotation-angle-of-a-rotated-2d-image">Calculating translation value and rotation angle of a rotated 2D image</a>, but I have no idea how to translate that code into C#.</p>
  
  <p>Also, I can't use any libraries that do all that for me, I need to implement the algorithm from scratch. I can only use byte arrays and the Bitmap class.</p>
  
  <p>Here are the picture examples:</p>
  
  <ul>
  <li><a href="https://i.stack.imgur.com/RKsqb.jpg" rel="nofollow noreferrer">Original (Blank)</a></li>
  <li><a href="https://i.stack.imgur.com/ovSPa.jpg" rel="nofollow noreferrer">Example 1</a></li>
  <li><a href="https://i.stack.imgur.com/1Qhg6.jpg" rel="nofollow noreferrer">Example 2</a></li>
  </ul>