feat: 提交0.4加速版二维码直传与自动配网优化
This commit is contained in:
@@ -60,6 +60,18 @@ data class LockRect(
|
||||
return d > max(width, height) / 18
|
||||
}
|
||||
|
||||
/** Intersection-over-union for consecutive finder-point measurements. */
|
||||
fun overlap(other: LockRect?): Float {
|
||||
if (other == null) return 0f
|
||||
val l = max(left, other.left)
|
||||
val t = max(top, other.top)
|
||||
val r = min(right, other.right)
|
||||
val b = min(bottom, other.bottom)
|
||||
val intersection = max(0, r - l).toLong() * max(0, b - t).toLong()
|
||||
val union = width.toLong() * height.toLong() + other.width.toLong() * other.height.toLong() - intersection
|
||||
return if (union <= 0L) 0f else (intersection.toDouble() / union.toDouble()).toFloat()
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* ZXing normally returns the finder-pattern centers. Their bounding box
|
||||
|
||||
Reference in New Issue
Block a user