SE511669C2 - Ways to optimize the choice of colors when presenting an image - Google Patents
Ways to optimize the choice of colors when presenting an imageInfo
- Publication number
- SE511669C2 SE511669C2 SE9800854A SE9800854A SE511669C2 SE 511669 C2 SE511669 C2 SE 511669C2 SE 9800854 A SE9800854 A SE 9800854A SE 9800854 A SE9800854 A SE 9800854A SE 511669 C2 SE511669 C2 SE 511669C2
- Authority
- SE
- Sweden
- Prior art keywords
- color
- block
- blocks
- size
- division
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/46—Colour picture communication systems
- H04N1/64—Systems for the transmission or the storage of the colour picture signal; Details therefor, e.g. coding or decoding means therefor
- H04N1/644—Systems for the transmission or the storage of the colour picture signal; Details therefor, e.g. coding or decoding means therefor using a reduced set of representative colours, e.g. each representing a particular range in a colour space
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/001—Texturing; Colouring; Generation of texture or colour
-
- G—PHYSICS
- G09—EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
- G09G—ARRANGEMENTS OR CIRCUITS FOR CONTROL OF INDICATING DEVICES USING STATIC MEANS TO PRESENT VARIABLE INFORMATION
- G09G5/00—Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators
- G09G5/02—Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators characterised by the way in which colour is displayed
- G09G5/06—Control arrangements or circuits for visual indicators common to cathode-ray tube indicators and other visual indicators characterised by the way in which colour is displayed using colour palettes, e.g. look-up tables
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Image Processing (AREA)
- Color Television Systems (AREA)
- Facsimile Image Signal Circuits (AREA)
- Color Image Communication Systems (AREA)
Abstract
Description
511 669 2 10 15 20 25 30 35 användas med en GIF-bild, utan den kan också minska antalet färgeri andra tillämpningar och ger därvid ett mycket bra resultat. 511 669 2 10 15 20 25 30 35 can be used with a GIF image, but it can also reduce the number of colors in other applications and thereby gives a very good result.
Vid uppfinningen löses de uppställda problemen genom att den får den utformning som framgår av det efterföljande självständiga patentkravet. Lämpliga utförings- former av uppfinningen framgår av övriga patentkrav.In the invention, the problems posed are solved by giving it the design which appears from the following independent patent claim. Suitable embodiments of the invention appear from other patent claims.
Uppfinningen kommeri det följande att beskrivas närmare under hänvisning till bifogade ritning, där fig. 1 visar ett exempel på ett histogram över röda färger, fig. 2 visar en färgkub, ett tredimensionellt histogram, fig. 3 visar en färgkub med två färgblock, fig. 4 visar trimning av färgblock, fig. 5 visar delning av färgblock, fig. 6 visar hur oturlig delning kan ge upphov till små närliggande block, fig. 7 visar sammanslagning av små närliggande block och fig. 8 visar hur sammanslagning kan leda till överlappning.The invention will be described in more detail below with reference to the accompanying drawing, in which Fig. 1 shows an example of a histogram of red colors, Fig. 2 shows a color cube, a three-dimensional histogram, fi g. Fig. 3 shows a color cube with two color blocks, Fig. 4 shows trimming of color blocks, Fig. 5 shows division of color blocks, Fig. 6 shows how unfortunate division can give rise to small adjacent blocks, Fig. 7 shows merging of small adjacent blocks and Figs. 8 shows how merging can lead to overlap.
Först måste olika begrepp som kommertill användning vid uppfinningen definieras. lndata äri den utföringsforrn av uppfinningen som kommer att beskrivas närmare nedan en True Color-bild, dvs. en rektangel med pixlar där varje pixel består av 24 bitar. Andra bildformat som läses in kan först omvandlas till en sådan bild. Altema- tivt kan uppfinningen få verka direkt på andra bildformat på ett motsvarande sätt.First, various concepts that will be used in the invention must be defined. The data in the embodiment of the invention which will be described in more detail below is a True Color image, i.e. a rectangle of pixels where each pixel consists of 24 bits. Other image formats that are loaded can first be converted to such an image. Alternatively, the invention may operate directly on other image formats in a corresponding manner.
Palettoptimeringen enligt uppfinningen kan användas så fort antalet färger i indata överstiger antalet färger som skall presenteras i utbilden.The palette optimization according to the invention can be used as soon as the number of colors in the input data exceeds the number of colors to be presented in the education.
I exemplet är varje pixel RGB kodad. Andra format kan omvandlas intemt till RGB.In the example, each pixel is RGB encoded. Other formats can be converted internally to RGB.
Det betyder att de 24 bitama delas upp på 8 bitar röd nivå, 8 bitar grön och 8 bitar blå nivå. Nivån för en enskild färg kan då variera mellan O och 255. 0 betyder släckt och 255 motsvarar full intensitet. l andra tillämpningar av uppfinningen kan man utnyttja andra uppdelningar i tre färger.This means that the 24 bits are divided into 8 bits red level, 8 bits green and 8 bits blue level. The level of an individual color can then vary between 0 and 255. 0 means off and 255 corresponds to full intensity. In other applications of the invention, other divisions in three colors can be used.
Utdata är en bild med en indexerad färgpalett. Utbilden har samma bredd och höjd som inbilden, och fungerar allt som det ska ser den ungefär likadan ut, samtidigt som antalet färger väsentligt minskat. 10 15 20 25 30 35 3 511 669 I indata finns hela färgkoden för en pixel lagrad i pixeln själv. Det finns därför inget behov av någon palett. I utdata finns en tabell med 2 till 256 färgkoder (i exemplet med 24 bitars RGB). En adress, ett index, till en kod i denna tabell består av 1 till 8 bitar. Färgkodtabellen kallas palett, och en pixel i utbilden består av ett index till paletten.Output is an image with an indexed color palette. The image has the same width and height as the image, and works everything as it should, it looks roughly the same, while the number of colors is significantly reduced. 10 15 20 25 30 35 3 511 669 The input data contains the entire color code of a pixel stored in the pixel itself. There is therefore no need for a palette. In the output there is a table with 2 to 256 color codes (in the example with 24 bit RGB). An address, an index, of a code in this table consists of 1 to 8 bits. The color code table is called a palette, and a pixel in the education consists of an index to the palette.
Föreliggande uppfinning är väsentligen ett program för att optimera paletten, dvs. fylla paletten med 24 bitars RGB koder som är så väl valda som möjligt. För en bild av en skog kommer ddet_t.ex. att finnas många olika gröna nyanser i paletten.The present invention is essentially a program for optimizing the palette, i.e. fill the palette with 24 bit RGB codes that are as well selected as possible. For an image of a forest, ddet_t.ex. there are many different shades of green in the palette.
Dessutom skall det skapas en utbild där pixlama är index till paletten, men det är en enklare uppgift.In addition, an education will be created where the pixels are the index to the palette, but it is a simpler task.
Uppfinningen arbetar med ett tre-dimensionellt histogram över färger. Det sanna histogrammet är en tredimensionell färgkub med, i exemplet, röd, grön och blå nivå längs var sin axel. Ofta ser man histogram över en färgnivå i taget, t.ex. den röda nivån, se fig. 1. Att ange histogram för de röda, gröna och blå nivåema var för sig är emellertid en förenkling. l fig. 2 visas en färgkub - ett äkta 3D histogram.The invention works with a three-dimensional histogram of colors. The true histogram is a three-dimensional color cube with, in the example, red, green and blue levels along each axis. You often see histograms over one color level at a time, e.g. the red level, see Fig. 1. However, specifying the histograms for the red, green, and blue levels separately is a simplification. Fig. 2 shows a color cube - a real 3D histogram.
För varje 24 bitars färg finns en cell i färgkuben, och i den cellen lagras antalet pixlar i indata-bilden som harjust den färgen. Man kan tänka sig att färgkuben innehåller ett "pixelmoln", med varierande täthet.For every 24-bit color, there is one cell in the color cube, and in that cell the number of pixels in the input image that has just that color is stored. It is conceivable that the color cube contains a "pixel cloud", with varying density.
Den färgkub som beskrivs ovan har 256 * 256 * 256 = 16 777 216 celler och varje cell kan vara ett 32 bitars heltal. Fârgkuben lägger då beslag på drygt 67 Megabyte RAM-minne. För en teoretisk matematiker och/eller superdatorinnehavare är detta inget problem alls, men i praktisk användning i bildbehandling är det det. Om där- emot 24-bitarsfärgen reduceras 18 bitar erhålls en kub om 64 * 64 ' 64 = 262 144 celler. Det går då åt drygt enïflagabyte, om varje cell har 32 bitar, och drygt en halv Megabyte för celler med 16 bitar. Denna storlek är fullt rimlig. 18 bitars färg är bättre än Hi Color och är egentligen onödigt bra för den aktuella tillämpningen.The color cube described above has 256 * 256 * 256 = 16 777 216 cells and each cell can be a 32 bit integer. The color cube then takes up just over 67 Megabytes of RAM. For a theoretical mathematician and / or supercomputer, this is not a problem at all, but in practical use in image processing it is. If, on the other hand, the 24-bit color is reduced by 18 bits, a cube of 64 * 64 '64 = 262 144 cells is obtained. It then takes just over one ï agabyte, if each cell has 32 bits, and just over half a megabyte for cells with 16 bits. This size is perfectly reasonable. 18 bit color is better than Hi Color and is really unnecessarily good for the current application.
Med 16 bitar per cell finns en liten risk att delar av färgkuben "mättas", dvs. att några celler slår i taket, eftersom 2" -1 inte är mer än 65 535. Detta innebär inte någon nämnvärd olägenhet. Som än lämplig storlek på färgkuben föreslås i det aktuella fallet 64 " 64 " 64 celler och ett sextonbitars heltal utan tecken för varje cell.With 16 bits per cell, there is a small risk that parts of the color cube are "saturated", ie. that some cells strike the ceiling, since 2 "-1 is not more than 65,535. This does not constitute a significant inconvenience. As the appropriate size of the color cube is proposed in the present case 64" 64 "64 cells and a sixteen-bit integer without signs of each cell.
I andra tillämpningar kan det vara lämpligt att använda altemativa färgkuber med andra storlekar. Om t.ex. utdata-bilden endast skall innehålla färger från standard 511 669 4 10 15 20 25 30 35 Netscape-paletten så blir en lämplig storlek på kuben 6 ' 6 * 6 = 216 celler (och cellema kan då ha 32 bitar eftersom varje cell innehåller fler pixlar när det finns färre celler).In other applications, it may be appropriate to use alternative color cubes of other sizes. If e.g. the output image should only contain colors from the standard 511 669 4 10 15 20 25 30 35 Netscape palette, then a suitable size of the cube will be 6 '6 * 6 = 216 cells (and the cells can then have 32 bits because each cell contains fl er pixels when there are fewer cells).
Det tredimensionella histogrammet måste kunna nollställas. Det skall därför finnas en funktion som sätter samtliga celleri färgkuben till noll. När man sedan skall lägga till en bild till histogrammet utför man i stora drag följande för samtliga pixlari bilden (indata): - Ta reda på röd, grön och blå nivå för den aktuella pixeln.It must be possible to reset the three-dimensional histogram. There must therefore be a function that sets all cells in the color cube to zero. When you then want to add an image to the histogram, you basically do the following for all the pixels in the image (input data): - Find out the red, green and blue levels for the current pixel.
- Omvandla färgnivåerna till lämpliga index i färgkuben, t.ex. avmnda 8 bitar till 6 bitar.- Convert the color levels to appropriate indices in the color cube, e.g. dec 8 bits to 6 bits.
- Den cell som utpekas av de tre indexen inkrementeras med ett, såvida den inte är mättad.- The cell designated by the three indices is incremented by one, unless it is saturated.
- Fortsätt med nästa pixel.- Continue with the next pixel.
Genom att tillåta att flera bilder läggs till histogrammet kan det bli möjligt att opti- mera en gemensam palett för dem. Det kan vara bra vid arbete med animationer.By allowing multiple images to be added to the histogram, it may be possible to optimize a common palette for them. It can be good when working with animations.
Det måste naturligtvis finnas en funktion för att läsa celleri färgkuben. Funktionen tar tre index (inte färgnivåer) som argument, och ger antalet pixlar i den utpekade cellen.Of course, there must be a function to read the cell in the color cube. The function takes three indices (not color levels) as arguments, and returns the number of pixels in the designated cell.
Uppfinningen kan vidare innefatta ett antal mindre viktiga funktioner. Exempel på sådana funktioner är. - ignorera nästan tomma celler Det kan finnas en funktion för att nollställa de celler i färgkuben som bara innehåller några enstaka pixlar, säg 1 till 10 stycken. Funktionen skall vara valbar. Om in- databilden innehåller enstaka ströpixlar med udda färger så kan man undvika att dessa i onödan tar upp värdefull plats i den färdiga paletten, förutsatt att strö- pixlama är ointressanta.The invention may further comprise a number of less important functions. Examples of such functions are. - ignore almost empty cells There may be a function to reset the cells in the color cube that contain only a few pixels, say 1 to 10 pieces. The function must be selectable. If the input image contains single scatter pixels with odd colors, you can avoid these unnecessarily taking up valuable space in the finished palette, provided that the scatter pixels are uninteresting.
Om man optimerar en liten bild med jämn färgfördelning får man se upp så att man inte nollställer hela färgkuben eller en stor del av den. 10 15 20 25 30 35 511 669 - Valbar mättnad Om cellema består av 16 bitar införs en automatisk mättnadsnivå om 65 535 pixlar per cell. Användaren kan tillåtas sätta en egen mättnadsnivå på säg 1000 till 65 535 pixlar. Man kan då undvika att stora enfärgade ytor blir alltför dominerande vid tilldelningen av palettfärger.If you optimize a small image with an even color distribution, you have to be careful not to reset the entire color cube or a large part of it. 10 15 20 25 30 35 511 669 - Selectable saturation If the cells consist of 16 bits, an automatic saturation level of 65,535 pixels per cell is introduced. The user can be allowed to set their own saturation level of say 1000 to 65,535 pixels. One can then avoid that large monochromatic surfaces become too dominant when assigning palette colors.
- Färgkub statistik Färgkuben kan också besvara några statistiska frågor, t.ex. hur många pixlar den innehåller totalt, hur många celler som har något innehåll osv. Omfattande statistik är dock inte nödvändig här. Sådana saker som min-, max-, medelvärde och stan- dardavvikelse för rött, grönt och blått handhas av de färgblock, som beskrivs i det följande.- Color cube statistics The color cube can also answer some statistical questions, e.g. how many pixels it contains in total, how many cells have any content, etc. However, comprehensive statistics are not necessary here. Things such as minimum, maximum, mean and standard deviation for red, green and blue are handled by the color blocks described below.
Ett färgblock är en rektangulär delvolym av färgkuben. För varje färgkub (det finns bara en) finns det mellan 1 och 256 färgblock, se fig. 3. Största storlek för ett färg- block är lika med hela färgkuben och minsta storlek är en enda cell i färgkuben.A color block is a rectangular subvolume of the color cube. For each color cube (there is only one) there are between 1 and 256 color blocks, see fi g. 3. The largest size for a color block is equal to the entire color cube and the smallest size is a single cell in the color cube.
Varje färgblock motsvarar exakt en färg i paletten och tvärtom. Listan med 1 till 256 färgblock är arbetsredskapet i palettoptimeringsfunktionen enligt uppfinningen. volymen av ett färgblock kan t.ex. beskrivas av sex variabler, som är index till färg- kuben: röd_min, röd_max, grön_min, grön_max, blá_min och blá_max.Each color block corresponds exactly to one color in the palette and vice versa. The list of 1 to 256 color blocks is the work tool in the palette optimization function according to the invention. the volume of a color block can e.g. is described by six variables, which are indices of the color cube: red_min, red_max, green_min, green_max, blue_min and blue_max.
Palettoptimeringen enligt uppfinningen påbörjas utgående från ett enda färgblock med samma storlek som hela färgkuben. Därpå utförs ett antal steg avseende trimning, klyvning och sammanslagning för att optimera en palett.The palette optimization according to the invention is started on the basis of a single color block with the same size as the entire color cube. Then a number of steps are performed regarding trimming, splitting and merging to optimize a pallet.
Trimning utgår från att ett färgblock aldrig skall tillåtas innehålla några tomma kanter. En sida som endast innehåller nollställda celler skalas därför bort, se flg. 4 beträffande sådan trimning. Varje block har sex sidor som kan skalas bort om de är tomma, vid behov i flera steg. Om ett block är helt tomt så kommer det vid trimning att krympa till nollstorlek och tas bort. (Helt tomma block skall egentligen aldrig före- komma.) lgnorerade pixlar, se ovan, kan vid trimning komma att hamna utanför alla block.Trimming assumes that a color block should never be allowed to contain any blank edges. A page that only contains reset cells is therefore peeled off, see fl g. 4 regarding such trimming. Each block has six sides that can be peeled off if empty, if necessary in several steps. If a block is completely empty, it will shrink to zero size during trimming and will be removed. (Completely empty blocks should never really appear.) Ignored pixels, see above, may end up outside all blocks when trimming.
När dessa pixlar senare skall tilldghs en färg i paletten får man ta den som råkar ligga närmast. 511 669 10 15 20 25 30 35 Efter trimningen är följande statistikvariabler redan kända: röd_min, röd_max, grön_min, grön_max, blá_min och blà_max. Det är samma variabler som beskriver blockets storlek.When these pixels are later to be assigned a color in the palette, you have to take the one that happens to be closest. 511 669 10 15 20 25 30 35 After trimming, the following statistical variables are already known: red_min, red_max, green_min, green_max, blue_min and blue_max. These are the same variables that describe the size of the block.
Dessutom beräknas: pixlar diagonal färg_mitt röd_mitt grön_mitt blå_mitt färg_storlek röd_storlek grön_storlek blà_storlek färg_medel röd_medel grön_medel blá_medel färg_awikelse röd_awikelse grön_avvikelse blâ_awikelse Totala antalet pixlar i blocket. Detta är ett av de två måtten pâ blockets storlek.Also calculated: pixels diagonal color_mid red_mid green_mid blue_mid color_size red_size green_size blue_size color_means red_means green_means blue_means color_division red_division green_division blue_division Total number of pixels in the block. This is one of the two measures of block size.
Längden på blockets rymddiagonal. Detta är det andra måttet på blockets storlek och är ett mått på hur dísparata färger blocket innehåller. (Blockets volym används inte som mått, eftersom ett Iångsmalt block kan vara mycket stort längs en axel och ändå ha liten volym.) Resp. sidas mittpunkt hos blocket. röd_mitt = (röd_min + röd_max) /2 Längden på blockets resp. sidor. röd_storlek = (röd_max + 1) - röd_min "Medelpunkten". färg_medel är medelvärdet av resp. färgnivå i blocket.The length of the block's space diagonal. This is the second measure of the size of the block and is a measure of how disparate colors the block contains. (The volume of the block is not used as a measure, as a long narrow block can be very large along an axis and still have a small volume.) Resp. side center of the block. red_mid = (red_min + red_max) / 2 The length of the block resp. pages. red_size = (red_max + 1) - red_min "Center". color_means is the mean of resp. color level in the block.
Standardavvikelse för respektive färgnivå.Standard deviation for each color level.
Då den lokala statistiken samlats för alla block beräknas lite global statistik: pixlar_medel Medelvärdet av antalet pixlar i blocken. (Totala antalet pixlar i kuben dividerat med antalet block.) 10 15 20 25 30 35 511 669 diagonal_medel Medelvärdet av blockens diagonaler.When the local statistics are collected for all blocks, some global statistics are calculated: pixels_means The average value of the number of pixels in the blocks. (Total number of pixels in the cube divided by the number of blocks.) 10 15 20 25 30 35 511 669 diagonal_ mean The mean value of the diagonals of the blocks.
Man kan nu beräkna lite ytterligare lokal statistik för varje block: = pixlar/ pixlar_medel Blockets pixelstorlek i förhållande till de andra blocken. pixlar_relativ = diagonal I diagonaI_medel Blockets diagonal, eller ”färgstorlek", iförhållande till de andra blocken. diagonal_relativ Blockets diagonal- och pixelstorlek är två mått som inte utan vidare är jämförbara med varandra, och dessutom varierar de på olika sätt när blockets volym ändras.You can now calculate some additional local statistics for each block: = pixels / pixels_means The pixel size of the block in relation to the other blocks. pixels_relative = diagonal In diagonal_medium The block's diagonal, or "color size", relative to the other blocks.diagonal_relative The diagonal and pixel size of the block are two dimensions that are not readily comparable to each other, and also vary in different ways when the block volume changes.
Syftet med att ta fram relativa storlekar är att de två måtten lättare skall kunna vägas mot varandra. Sådan jämförelse är nödvändig, eftersom uppfinningen inne- fattar momentet klyvning av fârgblock, dvs. att det största färgblocket i någon utvald mening väljs ut och delas upp itvå mindre.The purpose of producing relative sizes is to make it easier to weigh the two dimensions against each other. Such a comparison is necessary, since the invention comprises the step of splitting color blocks, i.e. that the largest color block in any selected sense is selected and divided into two smaller ones.
Ett block har som anförts två mått på sin storlek i förhållande till de andra blocken: pixlar_re|ativ och diagonal_relativ.As stated, a block has two measures of its size in relation to the other blocks: pixel_re | relative and diagonal_relative.
Det är användaren av programmet som avgör vilket mått som skall gälla och det kan vara möjligt att välja en kompromiss. Om man t.ex. väljer 60% prioritet på att minimera blockens diagonaler och 40% på pixlama, så gäller för varje block: vägd_storlek = 0.6 * diagonaljilativ + 0.4 * pixlar_relativ Om det är viktigt med en jämn fördelning av färgema i paletten så väljer man en hög prioritet för diagonalstorleken (färgmåttet). Om det är mer viktigt med bra färg- upplösning för areor som är storsj-Hailden, väljer man högre prioritet för pixelmåttet.It is the user of the program who decides which measure should apply and it may be possible to choose a compromise. If one e.g. selects 60% priority on minimizing the diagonals of the blocks and 40% on the pixels, this applies to each block: weighted_size = 0.6 * diagonallative + 0.4 * pixels_relative If it is important to evenly distribute the colors in the palette, choose a high priority for the diagonal size (the color measure). If it is more important with good color resolution for areas that are large-Hailden, you choose a higher priority for the pixel size.
Blocket med den största vägda sßfleken väljs ut för klyvning. Ett block som består av bara en cell är odelbart och får aldrig väljas för klyvning. Om det bara finns en- celliga block så måste palettoptimeringen avbrytas i förtid.The block with the largest weighted sßfleken is selected for splitting. A block consisting of only one cell is indivisible and must never be selected for cleavage. If there are only single-cell blocks, the palette optimization must be stopped prematurely.
Vid klyvning av ett block, se fig. 5, ökar det totala antalet block med ett. Blocket som klyvs skärs mitt itu med ett som är vinkelrätt antingen mot den röda, gröna eller blå axeln. Den axel som är störst väljs för delning. Här kan storleken återigen mätas på två sätt, sidans längd (Weller) eller motsvarande färgniväs standard- 511 669 8 10 15 20 25 30 35 avvikelse. Ett vägt medelvärde kan beräknas på samma sätt som för vägd_storlek ovan. röd_vägd_storlek = prioritet * (röd_storlek/ medelstorlek) + (1 - prioritet) * (röd_awike|se I medelawikelse), där medelstorlek och medelawikelse gäller lokalt för blocket.When splitting a block, see fi g. 5, increases the total number of blocks by one. The block that is split is cut in half with one that is perpendicular to either the red, green or blue axis. The largest axis is selected for division. Here, the size can again be measured in two ways, the length of the page (Weller) or the standard deviation of the corresponding color level 511 669 8 10 15 20 25 30 35. A weighted average value can be calculated in the same way as for weighted_size above. red_weighted_size = priority * (red_size / average size) + (1 - priority) * (red_awike | see In mean deviation), where mean size and mean deviation apply locally to the block.
Ett enklare och kanske mer robust mått är röd_vägd_storlek = prioritet * röd_storlek + (1 - prioritet) * röd_awikelse.A simpler and perhaps more robust measure is red_weighted_size = priority * red_size + (1 - priority) * red_reviation.
Eller ännu mer robust: röd_vägd_storlek = röd_storlek + (1 - prioritet) * röd_awikelse När en axel, röd, grön eller blå, har valts för delning skall läget för delningen bestämmas. Det kan vara axelns mittpunkt eller färgnivåns medelvärde eller en kombination av de två, t.ex: röd_klyv = prioritet ' röd_mitt + (1 - prioritet) * röd_mede| Samma prioritetsvärde bör kunna användas såväl för val av största block, val av klyvaxel som för val av klyvkoordinat. Klyvkoordlnaten avrundas naturligtvis till ett helt antal celler innan delning sker. De två nya blocken trimmas och statistik- behandlas. Sedan väljs ett nytt största block för klyvning.Or even more robust: red_weighted_size = red_size + (1 - priority) * red_division When an axis, red, green or blue, has been selected for division, the position of the division must be determined. It can be the center of the axis or the mean value of the color level or a combination of the two, eg: red_split = priority 'red_center + (1 - priority) * red_smith | The same priority value should be able to be used both for selection of the largest block, selection of splitting axis and for selection of splitting coordinates. The cleavage coordinates are of course rounded to a whole number of cells before division takes place. The two new blocks are trimmed and statistics processed. Then a new largest block for splitting is selected.
Om prioriteten för blockens pixelinnehåll är noll, tar algoritmen endast hänsyn till blockens cellstorlek. Programmet kan då snabbas upp, eftersom inhämtande av detaljerad pixelstatistik blir onödig.If the priority of the pixel content of the blocks is zero, the algorithm only takes into account the cell size of the blocks. The program can then be speeded up, as obtaining detailed pixel statistics becomes unnecessary.
När antalet block har uppnått ett förutbestämt antal, mellan 2 och 256, så är palett- optimeringens första steg avslutat. Efter detta kan man övergå till att skapa palet- ten, se vidare längre fram i beskrivningen.When the number of blocks has reached a predetermined number, between 2 and 256, the first step of pallet optimization is completed. After this, you can move on to creating the palette, see further later in the description.
I många fall är det dock lämpligt att även utföra ett andra steg avseende samman- slagning av små block innan paletten skapas. Har man nämligen otur vid block- klyvningen, kan av en slump två små block ligga nära varandra, när det önskade antalet block har uppnåtts, se fig. 6. Detta är inte optimalt.In many cases, however, it is advisable to also perform a second step regarding merging small blocks before creating the palette. Namely, if you are unlucky in the block splitting, two small blocks can by chance be close to each other, when the desired number of blocks has been reached, see fi g. 6. This is not optimal.
Genom att slå ihop de två små blocken till ett, som fortfarande är ganska litet, kan klyvningsprocessen fortsätta ett steg till, och det tillgängliga utrymmet i paletten 10 15 20 25 30 35 9 511 669 bättre tas tillvara. Denna procedur kan upprepas så länge som det finns två block som kan slås samman, utan att det sammanslagna blocket blir det största, se fig. 7.By merging the two small blocks into one, which is still quite small, the cleavage process can continue one step further, and the available space in the pallet 10 15 20 25 30 35 9 511 669 is better utilized. This procedure can be repeated as long as there are two blocks that can be merged, without the merged block being the largest, see fi g. 7.
Funktionen är lite kombinatoriskt besvärlig, men inte omöjlig att genomföra. Den ambitiöse användaren väljer vid varje tillfälle ut det par av block som efter sam- manslagning ger den allra minsta storleken. Vid sammanslagning av block finns en viss risk att det uppstår överlappande block, se fig. 8. Sådan överlappning kan antingen tillåtas eller förbjudas.The function is a bit combinatorially difficult, but not impossible to implement. The ambitious user selects at each occasion the pair of blocks that, after merging, give the smallest size. When merging blocks, there is a certain risk of overlapping blocks, see fi g. 8. Such overlap can either be allowed or prohibited.
Pixeldensiteten för färgkuben definieras som det totala antalet pixlar dividerad med hela färgkubens volym. Detta täthetsmått kan räknas ut en gång för alla och är sedan konstant under palettoptimeringens gång. Man kan på liknande sätt definiera pixeldensiteten för ett färgblock, men det måttet kan komma att ändras något när blocket trimmas, klyvs eller slås samman.The pixel density of the color cube is defined as the total number of pixels divided by the volume of the entire color cube. This density measure can be calculated once and for all and is then constant during the palette optimization process. The pixel density of a color block can be similarly reduced, but that dimension may change slightly when the block is trimmed, split or merged.
Ett blocks pixeldensitet kan normeras genom att den divideras med pixeldensiteten för hela färgkuben. Den normerade eller relativa pixeldensiteten, pixeldensitet_re|ativ, är större än ett (>1) om blocket är tätare än färgkuben i genomsnitt, och mindre än ett (<1) om blocket är glesare än så. Måttet ändras inte när andra block ändrar form.The pixel density of a block can be normalized by dividing it by the pixel density of the entire color cube. The standardized or relative pixel density, pixel density_re | ative, is greater than one (> 1) if the block is denser than the color cube on average, and less than one (<1) if the block is sparser than that. The dimension does not change when other blocks change shape.
Det innebär vissa nackdelar med att använda sig av blockens relativa diagonal och pixelinnehåll. Så fort någonting händer med ett enda block, kan dessa relativa storlekar ändras för samtliga block.This has some disadvantages in using the relative diagonal and pixel content of the blocks. As soon as something happens to a single block, these relative sizes can change for all blocks.
Vid eventuell sammanslagning avblock så skall ett ganska stort antal kombinato- riska möjligheter undersökas, för att man ska kunna utröna om det finns något par av block som tillsammans har en storlek som är mindre än det största enskilda blocket. Algoritmen blir besvärlígjorn samtliga block har olika storlek före och efter varje möjlig sammanslagning. i Det vore då bra om man i stället kunde använda ett storleksmått som är konstant för ett visst block, så länge som inte blocket själv ändras. Den absoluta diagonalen och det absoluta antalet pixlar är sådana konstanta mått, problemet är bara att kunna väga dem mot varandra. Diagonalen ökar linjärt med blockets storlek medan antalet pixlar ökar ungefär med kuben.In the event of a merger of blocks, a fairly large number of combinatorial possibilities must be investigated, in order to be able to ascertain whether there are any pairs of blocks that together have a size that is smaller than the largest individual block. The algorithm becomes cumbersome, all blocks have different sizes before and after each possible merger. i It would then be good if you could instead use a size measure that is constant for a certain block, as long as the block itself does not change. The absolute diagonal and the absolute number of pixels are such constant measurements, the problem is just to be able to weigh them against each other. The diagonal increases linearly with the size of the block while the number of pixels increases approximately with the cube.
Pixeldensiteten (relativ eller absolut) år inte direkt beroende av blockets storlek.The pixel density (relative or absolute) is not directly dependent on the size of the block.
Genom att multiplicera densíteten med diagonalen fås ett pixelmått som har samma 511 669 19 10 15 20 25 30 35 dimension som diagonalen. vägd_storlek = prioritet' diagonal + (1 - prioritet) * diagonal * pixe|densitet_relativ Lite försiktigare kan man i stället använda vägd_storlek = diagonal + (1 - prioritet) * diagonal " pixeldensitet_relativ Det kan vara en försiktighetsåtgärd att aldrig låta ett blocks storlek bli mindre än dess diagonal.By multiplying the density by the diagonal, a pixel dimension is obtained which has the same dimension as the diagonal. weight_size = priority 'diagonal + (1 - priority) * diagonal * pixe | density_relative A little more cautiously you can instead use weight_size = diagonal + (1 - priority) * diagonal "pixel density_relative It can be a precaution to never let a block size decrease than its diagonal.
Efter trimning, klyvning och sammanslagning återstår skapandet av paletten. På ett idé-mässigt plan finns alltid en ett-till-ett relation mellan färgblocken och färgema i paletten. Färgen för ett visst block kan t.ex. vara röd_klyv, grön_klyv och blà_klyv enligt ovan. lnnan dessa nivåer förs in i palett-tabellen, måste de omvandlas till 8 bitar för vane nivå. En något lite bättre färgprecision kan ibland uppnås, om t.ex. röd_klyv inte avrundas till en hel cell innan den omvandlas till 8 bitar.After trimming, splitting and merging, the creation of the palette remains. On an ideological level, there is always a one-to-one relationship between the color blocks and the colors in the palette. The color of a certain block can e.g. be red_split, green_split and blue_split as above. Before entering these levels into the palette table, they must be converted to 8 bits for the habit level. A slightly better color precision can sometimes be achieved, if e.g. red_split is not rounded to an entire cell before it is converted to 8 bits.
Till slut konstrueras en utdatabild, där pixlama består av index till paletten. För varje pixel hämtar man dess ursprungliga RGB-värde i indatabilden. RGB-värdet om- vandlas till index till en cell i färgkuben. Ett färgblock väljs, antingen ett block som innehåller cellen, eller annars det block som ligger närmast. Det index till paletten som motsvarar det valda blocket är korrekt utdata för aktuell pixel.Finally, an output data image is constructed, where the pixels consist of an index to the palette. For each pixel, its original RGB value is retrieved from the input image. The RGB value is converted to an index to a cell in the color cube. A color block is selected, either a block that contains the cell, or the block closest to it. The index to the palette that corresponds to the selected block is the correct output for the current pixel.
Som ett tillägg kan användaren använda en sk. dither-funktion vid konstruktion av utdatabilden Syftet är att åstadkomma skenbart flera färger genom rastrering. Hur detta går till är känt för fackmannen på området och beskrivs inte här.As an add-on, the user can use a so-called. dither function in the construction of the output data image The purpose is to achieve seemingly more colors by rasterization. How this is done is known to those skilled in the art and is not described here.
Om indata består av flera bilder så kan utdata göra detsamma. Principema är de- samma som för en enda bild, med den enda skillnaden att pixlama läses från och skrivs till flera bildrektanglar istället för en. Ofta när man arbetar med GlF-animatio- ner så vill man optimera en gemensam palett för en serie bilder.If the input consists of several images, the output can do the same. The principles are the same as for a single image, with the only difference that the pixels are read from and written to several image rectangles instead of one. Often when working with GlF animations, you want to optimize a common palette for a series of images.
En något enklare variant av den här beskrivna algoritmen har implementerats i Common Lisp på en Texas Explorer ll Lisp-maskin. Bilder från ett Teragon- bildbehandlingssystem i 24 bitsfärg visades på Texas-maskinen, som kunde visa 8- bitsfärg. Experimentet var lyckat. Palettoptimeringen fungerade bra. Nya versioner av algoritmen kan förväntas bli utförda som Windows 95/NT applikationer eller möjligen en applikation i Java.A slightly simpler variant of the algorithm described here has been implemented in Common Lisp on a Texas Explorer ll Lisp machine. Images from a 24-bit Teragon image processing system were displayed on the Texas machine, which could display 8-bit color. The experiment was successful. The palette optimization worked well. New versions of the algorithm can be expected to be executed as Windows 95 / NT applications or possibly an application in Java.
Claims (11)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
SE9800854A SE511669C2 (en) | 1998-03-16 | 1998-03-16 | Ways to optimize the choice of colors when presenting an image |
PCT/SE1999/000366 WO1999050820A1 (en) | 1998-03-16 | 1999-03-10 | Method for optimizing the choice of colours when presenting a picture |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
SE9800854A SE511669C2 (en) | 1998-03-16 | 1998-03-16 | Ways to optimize the choice of colors when presenting an image |
Publications (3)
Publication Number | Publication Date |
---|---|
SE9800854D0 SE9800854D0 (en) | 1998-03-16 |
SE9800854L SE9800854L (en) | 1999-09-17 |
SE511669C2 true SE511669C2 (en) | 1999-11-08 |
Family
ID=20410555
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
SE9800854A SE511669C2 (en) | 1998-03-16 | 1998-03-16 | Ways to optimize the choice of colors when presenting an image |
Country Status (2)
Country | Link |
---|---|
SE (1) | SE511669C2 (en) |
WO (1) | WO1999050820A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE20105152U1 (en) | 2001-03-25 | 2001-07-12 | Massen, Robert, Prof. Dr., 78337 Öhningen | Monitoring the left / right edges color difference of sheet-like materials |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4907075A (en) * | 1987-07-28 | 1990-03-06 | International Business Machines Corporation | Method for selecting colors |
US5222154A (en) * | 1991-06-12 | 1993-06-22 | Hewlett-Packard Company | System and method for spot color extraction |
AU2053297A (en) * | 1996-02-23 | 1997-09-10 | Karl L. Denninghoff | Method for color palette design and look-up |
-
1998
- 1998-03-16 SE SE9800854A patent/SE511669C2/en not_active IP Right Cessation
-
1999
- 1999-03-10 WO PCT/SE1999/000366 patent/WO1999050820A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
SE9800854L (en) | 1999-09-17 |
WO1999050820A1 (en) | 1999-10-07 |
SE9800854D0 (en) | 1998-03-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111105491B (en) | Scene rendering method and device, computer readable storage medium and computer equipment | |
EP0586082B1 (en) | Palettized fuzzy mask | |
US20030146925A1 (en) | Generating and using a color palette | |
US7804498B1 (en) | Visualization and storage algorithms associated with processing point cloud data | |
US5390035A (en) | Method and means for tetrahedron/octahedron packing and tetrahedron extraction for function approximation | |
US6445818B1 (en) | Automatically determining an optimal content image search algorithm by choosing the algorithm based on color | |
US20020146176A1 (en) | Method for representing and comparing digital images | |
US6411730B1 (en) | Histogram for generating a palette of colors | |
US10867428B2 (en) | Enhanced texture packing | |
CN103745498A (en) | Fast positioning method based on images | |
KR20140067252A (en) | Apparatus, method and computer readable recording medium for arranging a plurality of the items automatically in a space | |
CN111107274B (en) | Image brightness statistical method and imaging device | |
CN111405294A (en) | Storage and transmission method of image raster data | |
US10733769B2 (en) | Systems and methods for generating color schemes | |
US5815642A (en) | Image processing apparatus and method | |
KR100312331B1 (en) | System and method for searching image based on contents | |
CN114116721A (en) | Mass point cloud data management method | |
SE511669C2 (en) | Ways to optimize the choice of colors when presenting an image | |
US7023585B1 (en) | Multi-dimensional edge interpolation | |
CN115937396A (en) | Image rendering method and device, terminal equipment and computer readable storage medium | |
CN114707013A (en) | Image color matching method and device, terminal and readable storage medium | |
US6614425B1 (en) | System and method for the adaptive mapping of matrix data to sets of polygons | |
KR20000014123A (en) | Image likeness weighted value adjustment device and method and contents base image search system and method using thereof | |
CN109710784B (en) | Remote sensing image data space rapid visualization method based on lerc | |
US7019754B2 (en) | Apparatus and method for generating texture maps for use in 3D computer graphics |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NUG | Patent has lapsed |