-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dithering methods #279
base: master
Are you sure you want to change the base?
Conversation
Switched to proper names, per identified sources/typical names.
Decimal points were pointless and making the matrices harder to read.
2x3 matrix
3x4 matrix
2x3 matrix
2x5 matrix
Changed to Sierra (Filter Lite)
UniqueIDs should probably match ones in ditherMethods.js
Based on year of publication, variant/derivations and error diffusion vs ordered
Possibly pointless, who knows
Added Fan, Shiau-Fan, Shiau-Fan 2, Sierra and Sierra (Two-row)
Possibly pointless yet again, but who knows
From normal dash to en dash, wherever appropriate
@rebane2001 Just a quick heads up - I am not a developer/programmer, but the above seemed simple enough to implement. I don't have a way of testing any of the above, but I imagine that the changes I made should improve certain things as far as code readability, and other things as far as actual images/previews - I believe there were 1-2 matrices that had errors on top of the fluff I removed. The dither methods I added are all pre-2020 and do not have active patents, thus are free to use. Since they are derivations of others present in the list, they should also offer some improvements. If anything was changed erroneously and you think I can fix it - please highlight the issue and I will try my best. |
Because somebody made a mistake
Mistakes were made ¯\_(ツ)_/¯
Stevenson–Arce - hexagonal 7x4, 1985;
Added new dither method;
Added another dither method - Stevenson–Arce (1985), hexagonal, 7x4 matrix. I don't plan on adding anything else at this point, unless requested to. |
7 = 12
Bayer (8x8);
Added Bayer (8x8);
Off by 1;
3x3 matrix;
Add 3x3;
Fixed Stevenson-Arce (duplicate uniqueID), added Bayer 3x3 and 8x8 (added +1 to every point compared to typical matrices, as previously done). Current issues:
Note: Did not bug out all changed matrices, again - unclear why.
|
I can answer some of the questions/issues that you ran into. Regarding 1: Regarding 2: |
@Emix33 Thank you for the information! That does explain a lot. Now, excuse these follow-up questions, but I am curious:
I will fiddle with the matrices on my own, but per the current setup, it seems that 5x2 matrices still work, despite removing the last row - I think I compared these and they were giving the same output, but will recheck.
That would explain some obvious dithering patterns I saw, which I chalked up to the matrix itself, rather than to an error on my part.
Again, thank you for the input, anything else would be greatly appreciated. |
Sort of?
Hopefully no more sequels to this
Cluster dot 4x4, Halftone 8x8, Void and cluster 14x14
Added here too
Same dither result, calculation speeds up;
Typo fix
With the above commits, all dithers now work, added a few more ordered ones via derived matrices from the Libcaca study. Added:
Fixed:
Other:
Issues:
|
Wrong matrix, plus hexagonal vs square pixels;
Part 2
Removed:
The matrix I used was off, but even if it hadn't been wrong, it would have given bad results, as it was created for hexagonal pixels, rather than square ones, thus is would have given bad results. This should clean up the last issues - PR is ready for review/merging. |
Changes:
New list of dithering methods:
Sources for above:
https://community.wolfram.com/groups/-/m/t/1383824
https://momentsingraphics.de/BlueNoise.html
https://surma.dev/things/ditherpunk/
https://tannerhelland.com/2012/12/28/dithering-eleven-algorithms-source-code.html
https://en.wikipedia.org/wiki/Dither
https://www.researchgate.net/figure/Error-diffusion-scheme-for-different-dithering-algorithms-Floyd-Steinberg-a-Jarvis_fig1_347225976
https://www.visgraf.impa.br/Courses/ip00/proj/Dithering1/ordered_dithering.html
https://beyondloom.com/blog/dither.html
https://www.cs.princeton.edu/courses/archive/fall00/cs426/lectures/dither/dither.pdf
http://caca.zoy.org/study/part3.html
https://cs.wellesley.edu/~pmetaxas/ei99.pdf
https://cs.wellesley.edu/~pmetaxas/pdcs99.pdf
https://www.iro.umontreal.ca/~ostrom/varcoeffED/SIGGRAPH01_varcoeffED.pdf
https://web.archive.org/web/20190316064436/http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT
https://core.ac.uk/reader/327118630
https://github.com/robertkist/libdither/blob/main/src/libdither/dither_errordiff_data.h
https://bisqwit.iki.fi/jutut/kuvat/ordered_dither/error_diffusion.txt
https://devlog-martinsh.blogspot.com/2011/03/glsl-8x8-bayer-matrix-dithering.html