-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
In the following example
import ColorSchemes, DitherPunk
# numeric matrix
mat = let n = 61
[2 * x^2 + y^2 for x in -n:n, y in -n:n]
end;
# image of matrix with viridis color scheme
img = get.(Ref(ColorSchemes.viridis), mat, Ref(extrema(mat)))
# palette of 8 colors from viridis color scheme
c8 = get(ColorSchemes.viridis, 0.0:1//7:1.0)
# dither image
dither_img = DitherPunk.dither(img, c8)the dithered image does not look right. For comparison I also show the result of https://ditherit.com with the same palette.
| img | dither_img | ditherit |
|---|---|---|
![]() |
This behaviour somehow depends on the image size. For a small image size let n = 31 the results looks better
| img | dither_img |
|---|---|
Except for Atkinson all error diffusion algorithms have this problem
let mat, img, n = 91, dithers
mat = [2 * x^2 + y^2 for x in -n:n, y in -n:n]
img = get.(Ref(ColorSchemes.viridis), mat, Ref(extrema(mat)))
dithers = [Atkinson(), SimpleErrorDiffusion(), FloydSteinberg(), Burkes(),
Stucki(), JarvisJudice(), Sierra(), TwoRowSierra(),
SierraLite(), Fan93(), ShiauFan(), ShiauFan2()]
hvcat(4, reshape([dither(img, d, c8) for d in dithers], (4,3))...)
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
