title: Need a Recommendation for Deskew Method
body: <p>I'm currently working on a small JavaFX program for stamp collectors.  The idea is to allow the user to load a scan of a postage stamp and manipulate it in various ways.  I've run into a small roadblock with one particular feature, however, and I'm looking for input from the experts on what approach to take.</p>
  
  <p>My current problem is how to deskew the image.  Here's a <a href="http://www.germanstamps.net/images/uploads/stamp_example.jpg" rel="nofollow">sample iamge</a>.</p>
  
  <p>I initially tried <a href="http://anydoby.com/jblog/en/java/1990" rel="nofollow">this method</a>, which uses a variant of a Radon transform.  It works well as long as the stamp has straight edges.  With stamps that have perforations around the edges, however, it produces wildly variable results.</p>
  
  <p>Because of variations within postage stamp designs, the optimal solution would be one in which I can detect the perforation circles and align them.</p>
  
  <p>Before I start down another rabbit trail, does anyone have any suggestions as to what would be a good method to make this work?  I don't necessarily need code (though that would be great), I'm really just looking for some guidance from those with a better understanding of what the possible options are.</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT:  After some additional testing, it appears the problem with the current Radon transform is not the uneven edges of the perforated stamps, but rather the initial skew angle of the image.  </p>
  
  <p>Anything within about 5 degrees of vertical produces a correct skew angle, and is properly rotated into alignment.  Anything more than about 5 degrees generates an incorrect skew angle -- interestingly enough, the same incorrect skew angle (0.001953122516 radians) every time, regardless of whether the source image is at a 15 degree angle or 45 degrees.</p>