There seem to be several issues with the code:
- It picks the minimum instead of the maximum
- It shrinks both dimensions by a factor of
sqrt(2)
- For large distortion angles, this looks very wrong
|
float w1 = sqrt( pow(x4 - x3 , 2) + pow(x4 - x3, 2)); |
|
float w2 = sqrt( pow(x2 - x1 , 2) + pow(x2-x1, 2)); |
|
float h1 = sqrt( pow(y2 - y4 , 2) + pow(y2 - y4, 2)); |
|
float h2 = sqrt( pow(y1 - y3 , 2) + pow(y1-y3, 2)); |
|
|
|
float maxWidth = (w1 < w2) ? w1 : w2; |
|
float maxHeight = (h1 < h2) ? h1 : h2; |
|
|
|
Mat dst = Mat::zeros(maxHeight, maxWidth, CV_8UC3); |
Any ideas how to improve this?
There seem to be several issues with the code:
sqrt(2)AndroidScannerDemo/ScanDemoExample/scanlibrary/src/main/jni/scan.cpp
Lines 134 to 142 in ec17c27
Any ideas how to improve this?