Retinex kernel sizes should depend on image size

This commit is contained in:
Pierre-Yves Nicolas
2025-09-20 18:49:18 +02:00
parent b03b2f98e2
commit c8b2659703

View File

@@ -97,7 +97,11 @@ fun isColoredDocument(
}
private fun multiScaleRetinex(img: Mat, kernelSizes: List<Double> = listOf(30.0, 500.0)): Mat {
private fun multiScaleRetinex(img: Mat): Mat {
val imageSize = img.size()
val maxDim = max(imageSize.width, imageSize.height)
val kernelSizes: List<Double> = listOf(maxDim / 50, maxDim / 3)
// Convert to grayscale (1 channel)
val gray = Mat()
if (img.channels() == 4) {