Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!ogicse!pdxgate!eecs!bairds From: bairds@eecs.cs.pdx.edu (Shawn L. Baird) Newsgroups: comp.sys.amiga.programmer Subject: Re: xxx to HAM algorithm Message-ID: <1257@pdxgate.UUCP> Date: 24 Jan 91 02:07:12 GMT References: <1991Jan23.170826.6194@uni-paderborn.de> Sender: news@pdxgate.UUCP Lines: 34 massa@uni-paderborn.de (Michael Janich) writes: >Hi out there, >I'm searching for a GOOD algorithm to convert more than 32 colors to HAM. I >saw the following: >(ppmtoilbm) > -Color map are the 16 gray scales (000, 111, ...) > -calculate for the 4 possibilities (change red, blue, green or take > color map) the differences like > delta_green = abs(oldred - red) + abs(oldblue-blue); > -take the minimum of these differences. >The output is ugly - compared with that from HamLab (in my opinion the best >GIF2HAM converter). Try scanning the picture from left to right, first, calculating contrast differences to locate areas where fringing is likely to occur. Place colors into a colormap until you have allocated all 16 color entries. Then use a similar algorithm as you describe above to determine which color to use. What I do is compute the three possible colors if I change each of the R, G and B values to the value I desire for the next pixel. Then I compare these three colors and the sixteen colors in the colormap to determine which to use. I suppose you could get more detailed in detecting contrast differences, since the difference in the contrast between bright and dark green and bright and dark red would probably no be exactly the same. It may even be more beneficial to convert to Hue-Saturation-Brightness (or whatever) to detect differences in hues specifically. For true excellence change 15 of the palette colors each scanline to dramatically reduce fringing (SHAM or AHAM). | Shawn L. Baird | Or via US Snail: | | bairds@eecs.ee.pdx.edu | 17650 SE Cason Rd. | | ...uunet!tektronix!psueea!eecs!bairds | Gladstone, OR 97027 |