How to detect rotation angle 0 , -90 ,+90 or 180
I would like to detect the rotation angle of scanned ID card here there are the sample images
[C:\fakepath\+90 Degree.jpg](/upfiles/147810224236179.jpg)
The first method Use Template matching , the idea is as follow
1-Select the Template object which is the area not changed in the card printing i used the following area to be a template, it's the card logo
2-Use the following tutorial Features2D + Homography to find a known object
3-The result will be as follow
The drawbacks of the method are
1-Detection for one type of ID's and i have a lot of card types.
2-it seems this method is slow
Thanks for help any idea is appreciated to find Generic method for different ID cards
It took me 5 seconds to come up with around four ideas and you really have none? Where is your own work?
If you are only interested to the angles (-90, +90, 180), an ID card is pretty standardized so you should be able to use for example the photo location with respect to ID card for your task.
Or you can use features matching, estimate the affine transformation and extract the rotation angle.
Thanks @FooBar i had added one method to solve the problem, i'm working on finding other methods such as
These these are the four methods come in my mind , do you have another ideas ?
Thanks @Eduarado the cards are only standard in size only , the image location and the text data inside are changing from type to type so how to use affine transformation to detect the angle.
Hey! These are possible approaches, have you also thought about template matching without features: cv::matchTemplate I also thought about detecting (or reading the barcode. e.g. using zbar). OpenCV has also some OCR capabilities: OCRTesseract
@FooBar , matchTemplate very time consuming , i have nearly 40 card type so i must prepare 4 templates for every type(0.-90,+90,180), finally i will have 4*40 = 160 template , if i have new scanned card i will do 160 matchtemplate to detect the orintation , it's very expensive in time , regarding the bardcode it's a good idea but it will not succeed in the cards which does not have bardcode . i will check if tesseract contain automatic rotation correction for ID , tesseract use library called leptonica to do image processing
If you have additional requirements (e.g. cards without barcode) it would be helpful to integrate this information into the question. How do you expect someone to guess this?
OK i will do , thanks