3

Long story short, there is this hardware that can only display around 6-7 types of irregular pixels like (47,160,30), (229,52,10),(0,60,190), etc. How do display an RGB image with these irregular pixels with minimum error? My approach is just displaying the pixel closest to the original(by checking the difference on RGB values) with dithering, but the results seem always off. Is there a way I can somehow compare the colors, or any book I can refer to?

  • How are you doing the dithering? What is the resolution of the display device? – Eric J. Oct 20 '16 at 21:49
  • I used Floyd–Steinberg method. The resolution is 178*178, but it's very easy to put several screen together to form a larger screen. @Eric J. – Yunsheng Guo Oct 20 '16 at 21:59
  • Give Stucki dithering a try. It distributes the dithering error across more pixels so may give you a more realistic result at the expense of processing time http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/ (search for Stucki). – Eric J. Oct 20 '16 at 22:07
  • Thanks for the help. I'll see if it works. @Eric – Yunsheng Guo Oct 20 '16 at 23:05
  • here [simple C++ Dithering](http://stackoverflow.com/a/36820654/2521214) which is exactly what you want to do as it use predefined palette (which you will replace with your colors ...). – Spektre Oct 21 '16 at 07:39
  • That's an interesting contraption xD Thanks. @Spektre – Yunsheng Guo Oct 21 '16 at 08:11
  • I used a similar approach. Problem is if your palette is not that distributed, the final product will looks off. @Spektre – Yunsheng Guo Oct 21 '16 at 08:50
  • @YunshengGuo add sample images and the list of colors used. Would like to give it a shot. sometimes dampening of the error accumulator helps to get rid of the infinite noise oscillations. – Spektre Oct 21 '16 at 08:54

1 Answers1

1

In order to calculate the distance between colours from a human point of view you will need to convert RGB to a Lab colour space. This wikipedia article has all math you will need: https://en.wikipedia.org/wiki/Color_difference and this one https://en.wikipedia.org/wiki/Lab_color_space#RGB_and_CMYK_conversions has the math on conversion between RGB and Lab

A solution is also proposed in this answer: Compare RGB colors in c#

And a library available here: https://github.com/THEjoezack/ColorMine

Community
  • 1
  • 1
bib1257
  • 325
  • 2
  • 7