Currently this uses a simple heuristic to clamp rotation to even 90° increments. It should be possible to read the rotation portion of the homography data to calculate a rectangle which more closely matches the original orientation but that will probably require some additional tuning for alignment, particularly near edges.
Currently this uses a simple heuristic to clamp rotation to even 90° increments. It should be possible to read the rotation portion of the homography data to calculate a rectangle which more closely matches the original orientation but that will probably require some additional tuning for alignment, particularly near edges.