task 7
This commit is contained in:
parent
0a7a647126
commit
0943bfa193
@ -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
|
||||
})
|
||||
}
|
||||
|
@ -31,10 +31,12 @@ object ImageProcessingApp extends App {
|
||||
val blur = new ImageGraphics(imageFile, "Blurred", -768, 0)
|
||||
val edges = new ImageGraphics(imageFile, "Edge detection", -256, 0)
|
||||
val sobel = new ImageGraphics(imageFile, "Sobel", 256, 0)
|
||||
val noise = new ImageGraphics(imageFile, "Noise", -768, 512)
|
||||
|
||||
bw.setPixelsBW(ImageFilters.duplicate(org.getPixelsBW()))
|
||||
threshold.setPixelsBW(ImageFilters.threshold(org.getPixelsBW(), 128))
|
||||
blur.setPixelsBW(ImageFilters.mean(org.getPixelsBW(), 3))
|
||||
edges.setPixelsBW(ImageFilters.edges(org.getPixelsBW()))
|
||||
sobel.setPixelsBW(ImageFilters.sobel(org.getPixelsBW(), 0.3))
|
||||
noise.setPixelsBW(ImageFilters.noise(org.getPixelsBW(), 30))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user