There is a nice app on my Android phone called OfficeLens. It allows you to compose a picture of a namecard or a sheet of paper, it detects the edges of the namecard/paper and automatically crops away the outside retaining just the internal of the card/paper when you snap the photo.
It seems to correctly detect if the phone is not perfectly aligned to the namecard, in yaw, pitch and roll and applies an appropriate transform to make the information in the namecard as perfect as possible.
I want to do the same with photos from my camera (due to higher resolution and better quality), using imagemagick. I have tried this:
Code: Select all
convert input.jpg -fuzz 30% -trim +repage output.jpg
However this will not compensate if the camera was slightly rotated along any of the 3 possible axes of rotation. Is there a way to reproduce the Office Lens functionality in imagemagick?