This commit is contained in:
2023-12-04 21:32:30 +01:00
parent 0a7a647126
commit 0943bfa193
2 changed files with 6 additions and 0 deletions

View File

@@ -68,4 +68,8 @@ object ImageFilters {
(Math.sqrt(dx*dx + dy*dy)*intensityFactor).toInt
}
})
def noise(a: Array[Array[Int]], intensity: Double): Array[Array[Int]] = filter(a, (value) => {
Math.max(0, Math.min(255, value + (Math.random()*2-1)*intensity)).toInt
})
}