ClassicalKtpDetector

Model-free card locator (pure Kotlin, no native code), meant as a fast fallback and for low-end devices.

Method: estimate the background colour from the image border, segment everything that differs from it (Otsu), keep the largest connected blob, take its convex hull and fit four corners.

Works best with a card on a plain, contrasting surface that leaves a visible margin on all sides. It will fail on cluttered backgrounds, cards that fill the whole frame, and cards whose colour matches the surface - a learned detector is the right tool there, which is why KtpDetector is an interface.

Constructors

Link copied to clipboard
constructor(config: ClassicalKtpDetector.Config = Config())

Types

Link copied to clipboard
data class Config(val analysisSize: Int = 320, val minAreaRatio: Double = 0.08, val maxAreaRatio: Double = 0.97, val minContrast: Int = 30, val minRectangularity: Double = 0.85)

Functions

Link copied to clipboard
open override fun detect(image: RgbImage): KtpDetection?