mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Add comment to distortion calculation
The formula for calculating the distortion seems wrong but practically it seems to work slightly better
This commit is contained in:
parent
193990a0e1
commit
bd2521cb8e
|
@ -695,6 +695,8 @@ public class FinderPatternFinder {
|
||||||
// we need to check both two equal sides separately.
|
// we need to check both two equal sides separately.
|
||||||
// The value of |c^2 - 2 * b^2| + |c^2 - 2 * a^2| increases as dissimilarity
|
// The value of |c^2 - 2 * b^2| + |c^2 - 2 * a^2| increases as dissimilarity
|
||||||
// from isosceles right triangle.
|
// from isosceles right triangle.
|
||||||
|
// Heuristically it seems that the following formula works better (although it's
|
||||||
|
// not clear any more why...)
|
||||||
double d = Math.abs(c - 2 * b) + Math.abs(c - 2 * a);
|
double d = Math.abs(c - 2 * b) + Math.abs(c - 2 * a);
|
||||||
if (d < distortion) {
|
if (d < distortion) {
|
||||||
distortion = d;
|
distortion = d;
|
||||||
|
|
Loading…
Reference in a new issue