Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!mcsun!unido!isaak!leonardo!schwarze From: schwarze%leonardo@isaak.uucp (Jochen Schwarze) Newsgroups: comp.graphics Subject: Re: How to map 24-bit RGB to 256 co Message-ID: <1412@isaak.UUCP> Date: 3 Sep 89 11:38:37 GMT References: <2009@uceng.UC.EDU> <5300026@ux1.cso.uiuc.edu> Sender: news@isaak.UUCP Reply-To: schwarze%leonardo@isaak.UUCP (Jochen Schwarze) Organization: ISA GmbH, Stuttgart, West-Germany Lines: 31 Bcc: schwarze Well, this might have been dicussed before and I don't know if it helps for the topic, but anyway: To map a large number of gray scale levels to a considerable smaller one (say 65536 to 64 or so) I used an algorithm that numerically integrates the gray scale histogram of the image and uses the integrated table to map from the large number of levels to the small one. In pseudo code: int histogram[ 0..65535 ] foreach pixel ++histogram[ pixel_value ] foreach i from 1..65535 histogram[ i ] += histogram[ i - 1 ] The histogram table now contains a growing series (don't know the exact term in English) of numbers. It has its biggest slope, i.e the finest resolution in that range of pixel values that mainly occur in the image. The histogram table can then be scaled down by a factor like 64 / num_pixels (if 64 is the number of gray scale levels one has) and used as a mapping table. Now, this is 1D only. Does anyone have an idea, wether anything similar could be done in a 3D RGB color space? Any suggestions? Jochen Schwarze Domain: schwarze@isaak.isa.de ISA GmbH, Stuttgart, West Germany UUCP: schwarze@isaak.uucp BITNET: schwarze%isaak.uucp@unido.bitnet Bang: ...!uunet!unido!isaak!schwarze