Image Alignement issue in Opencv [closed]
If I have two images
Image 1: Aligned properly http://i.imgur.com/ui6wTiJ.jpg Aligned properly
Image 2: Not aligned properly http://i.imgur.com/Z05ZfwR.jpg Not aligned properly
My algorithm compares two images but it needs both the images aligned properly. I was thinking of putting some unique marker at top-left corner but is there another way to align the images properly?
If your images will always be that clear there are some simple steps
Please see picture http://i.imgur.com/ptGGTrB.png Hough Line returns me 28 lines and really its very hard to judge the longest line i.e it can be vertical or horizontal.
Did you use HoughLinesP? It has a better accuracy. Also you should apply a thinning algorithm to the detected edges. You want 1 pixel to remain!
Yeah I used HoughLinesP.Maybe something wrong with the parameters?? cv::HoughLinesP(copiedImg, lines, 1, CV_PI / 180, 70, 30, 10);
Seems good to me, guess you will need a line thinning algorithm. Quick google should give you some hints.
http://opencv-code.com/quick-tips/implementation-of-guo-hall-thinning-algorithm/
http://opencv-code.com/quick-tips/implementation-of-thinning-algorithm-in-opencv/
http://opencv-code.com/tutorials/automatic-perspective-correction-for-quadrilateral-objects/
thinning algorithm is not working properly input :http://i.imgur.com/ui6wTiJ.jpg Output :http://i.imgur.com/BijtKNF.png
That is because you are running the thinning algorithm on your original input image! You should apply it in combination with my previous steps ofcourse. Apply the thinning algorithm on the output you supplied after my first suggestion.