10c829906bCheckpoint - Repeatedly refit palettes since k-means is only a local optimization. This can produce incremental improvements in image quality but may also overfit, especially on complex images. - use pygame to render incremental images - Fix off-by-one in palette striping - When fitting palettes, first cluster a 16-colour palette for the entire image and use this to initialize the centroids for individual palettes. This improves quality when fitting images with large blocks of colour, since they will otherwise be fit separately and may have slight differences. With a global initializer these will tend to be the same. This also improves performance.
kris
2021-11-16 11:21:53 +0000
643e50349eOptimize more
kris
2021-11-13 17:29:13 +0000
0596aefe0bUse pyclustering for kmedians instead of hand-rolled
kris
2021-11-13 17:18:34 +0000
52af982159k-means should be using median with L1 norm, otherwise it may not converge
kris
2021-11-13 16:10:33 +0000
5cab854269Fit palettes from overlapping line ranges, and map line to palette when dithering with two limitations:
kris
2021-11-11 16:10:03 +0000
ee2229d0ea* Modify Floyd-Steinberg dithering to diffuse less error in the y direction. Otherwise, errors can accumulate in an RGB channel if there are no palette colours with an extremal value, and then when we introduce a new palette the error all suddenly discharges in a spurious horizontal line. This now gives quite good results!
kris
2021-11-11 11:10:22 +0000
8c34d87216WIP - interleave 3 successive palettes for each contiguous row range. Avoids the banding but not clear if it's overall better
kris
2021-11-10 18:30:39 +0000
322123522cAssign scan lines randomly to palettes and cluster independently. This doesn't give good results either, since neighbouring lines end up getting similar but not identical colours, which still results in horizontal striping.
kris
2021-11-10 00:34:17 +0000
fb52815412Experiment with striping 16 palettes contiguously across line ranges. As expected it has clear banding. A better approach (though still not optimal) might be to assign lines to palettes randomly.
kris
2021-11-09 22:42:27 +0000
80885aabf9Working SHR version. Still just uses a single palette
kris
2021-11-09 22:26:34 +0000
1010b64272Fix shift_pixel_window when shift_right_by > window_width
kris
2021-11-03 15:19:29 +0000
34ae40ac2dFix a bug with output for non-ntsc palette
kris
2021-11-03 15:17:57 +0000
b7174778e6Oops, no that was wrong. I forgot to cross-check against OpenEmulator <o>
kris
2021-11-03 12:40:22 +0000
bf76271d75NTSC conversion should be using YIQ space instead of YUV, which seems to explain several fudge factors I needed to include to match colours.
kris
2021-11-02 23:28:58 +0000
d35cdbc877Switch remaining palettes to be indexed by (n-bit pixel value, NTSC phase) and update the comments to explain the encoding scheme.
kris
2021-11-02 22:15:13 +0000
75a3c6bc48Simplify image_to_rgb and remove the need for DOTS and DOTS_TO_INDEX
kris
2021-11-02 15:14:22 +0000
809b975e6eReturn a bitmap directly from dither_image. This removes the need to deal with n-bit encodings at all in DHGRScreen
kris
2021-11-02 14:42:00 +0000
8cfee55b1dGet rid of support for 140px mode, it was only useful as a demo of why other converters have the wrong basic approach.
kris
2021-11-02 13:40:32 +0000
d442baf1f1Tidy a bit
kris
2021-11-02 12:30:43 +0000
5675fac40dClean up a bit and accommodate palette depth in sliding pixel window
kris
2021-11-02 12:29:30 +0000
24644658cbTidy a bit
kris
2021-11-01 12:10:02 +0000
e5c49b3518Floyd-Steinberg is working well now, and gives better detail
kris
2021-07-19 18:39:38 +0100
feefdb5dc6Use .npy format for RGB to CAM16UCS conversion matrix, and get rid of precomputed CIE2000 distances
kris
2021-07-19 18:35:44 +0100
e979df03bcNope, don't need XYZ
kris
2021-07-19 18:13:43 +0100
8b500b16cbDither in XYZ representation but use CAM16UCS for colour differences. This gives the best of both worlds: dithering in a linear space, with good (and fast) perceptual error differences
kris
2021-07-19 17:54:46 +0100
4984df7f7aTidy up and optimize a bit
kris
2021-07-19 13:21:32 +0100
4fcda908bdWIP - use colourspacious to perform image dithering in CAM02_UCS colour space, which is supposed to be perceptually uniform. i.e. we can use Euclidean distance instead of CIEDE2000
kris
2021-07-15 13:58:22 +0100
9bbb9fda7cFix typos in x transition labels
kris
2021-07-15 09:41:57 +0100
aef135808cRename files to match existing scheme
kris
2021-03-15 11:05:56 +0000
61052ca93cAdd DHR and preview images rendered with --palette=ntsc
kris
2021-03-15 10:59:04 +0000
e1108b4dd0Tidy up a bit in preparation for merge.
kris
2021-03-15 10:45:57 +0000
467a0cd196Tidy up a bit to prepare for merge
kris
2021-03-15 10:45:33 +0000
d5bd173345Update to describe NTSC emulation
kris
2021-02-18 00:53:43 +0000
e0b732cdaaReimplement NTSC conversion to closely match openemulator output. I can't figure out why contrast=2 is needed (openemulator uses a default value of 1, so there must be a factor of 2x somewhere), or where the slight hue rotation comes from - perhaps this is somehow introduced by the more complex band-pass filtering that openemulator does?
kris
2021-02-17 21:29:43 +0000
ad9515dcf2Implement NTSC emulation, using an 8 pixel window for chroma signal. Use this to precompute a new ntsc palette with 256 entries (though only 84 unique colours) that are available by appropriate pixel sequences. Unfortunately the precomputed distance matrix for this palette is 4GB!
kris
2021-02-14 23:34:25 +0000