new weight = a (E) + b (S) E: abs( edge weight (from lookup table)- middle-weight) S: region size (E ) (E + 0.25 S) (E + 0.5 S) (E + 0.75 S) (closest color)Set all the regions to 0 (could be also FLT_MIN) except the source that should be set to FLT_MAX. Set priority to largest on top. recolor the popped region, then For each neighbor of popped region (up): alt = min( (up->colordist , neighbor->edgeweight) and we have condition for each neighbor of popped region(up): if( alt > neighbor-> colordist ) neighbor-> colordist = alt. neighbor-> parent = up if neighbor not visited push to Q EuclideanCMCR0 method recolors region once they popped put of the queue. R1 method recolors region before they pushed to the queue. Both methods use closest pair from palette. lum refers to luminance direction being applied when finding the closest pair, and mindif just considers closes pairs. Random method on the last table returns one color from palette that is closest to the region color. average colors R0_lum :cmc R1_lum:cmc R0_mindif:cmcaverage colors R0_lum :cmc R1_lum:cmc R0_lum:Euclid R1_lum:Euclid R0_mindif:EuclidReduced colors from sunset color palette from 10 to 5 |
Order of regions process |
Color assignments to a region |
Distance metrics |
Shortest path |
a) Relative luminance and minimum color difference b) Closest color to regions |
Euclidean, CMC, CIE (76,94,2000) |
Edge weights |
a) Relative luminance and minimum color difference b) Closest color to region |
Euclidean, CMC, CIE (76,94,2000) |
Path free (random coloring) |
a) Closest color to region and minimum color difference b) relative luminance |
Euclidean, CMC, CIE (76,94,2000) |
Symbols
Direction of luminance changes: |
Diff = abs(EdgeWeight - diffcolorPal ) |
distance between pairs |
if (A_lum >=B_lum) signr = true else signr = false |
diffcolorPal = colorDifferance(palette[i], palette[j]) |
palette color difference |
if (Pi_lum >= Pj_lum) signp= true else signp = false |
EdgeWeight = edge->weight |
regions color difference |
Condition Symbols |
Description |
Min_colorDiff (Pj) |
return a color Pj that minimizes Diff |
Min_colorDiff (Pi, Pj) |
return a pair (Pj,Pj) that minimizes Diff |
Lum_check(Pj, palette[a], A, B) |
Checks if signs of the luminance directions of the pairs and edge weights are the same |
Color assignment methods
Possible methods |
Region A is colored with palette [a] and B is not colored |
Both regions are not colored |
What problems will be addressed |
M1 |
case1: For each color (j) in the palette: if ( Min_colorDiff (Pj) AND Lum_check ) returns (Pj) /*****if there is no match from the palette with case 1*****/ case2 : For each color in the palette: if ( Min_colorDiff (Pj) ) return (Pj) |
For each pairs of colors (i,j) from palette: if (Min_colorDiff (Pi,Pj)) return (Pi,Pj) Colors will be assigned to each region with respect to the luminance directions. |
Pros: Compare to M2 more contrast and detail preservation Cons: case 2 enforcing contrast preservation that can cause miscoloring |
M2 |
case1: For each color (j) in the palette: if ( Min_colorDiff (Pj) AND Lum_check ) returns (Pj) /****if there is no match from the palette with case 1*****/ case2 : If (B_lum >= A_lum ) For each color (j) in the palette: if(Pj_lum >= palette[a]_lum AND Min_colorDiff(Pj)) return (Pj) If (B_lum < A_lum ) if(Pj_lum <= palette[a]_lum AND Min_colorDiff(Pj)) return (Pj) |
same as above |
Pros: Uniformity in color change Cons: not proper color transitions, can trap in a color and reduce overall contrast |
M3 |
case1: For each color (j) in the palette: if ( Min_colorDiff (Pj) AND Lum_check ) returns Pj /*****if there is no match from the palette with case 1*****/ case2 : For each pairs of colors (i,j) from palette: if (Min_colorDiff (Pi,Pj)) return (Pi,Pj) Update the colored region with new color Note: colors will be assigned to each region with respect to the luminance directions. |
same as above |
Pros: Contrast and details preservation Cons: not proper color transitions, new pairs can cause many miscolorings |
M4 |
For each color (j) in the palette: if (Lum_check ) then return Min_colorDiff (Pj) (first consider just luminance of signs, then closeness) if there is no match from the palette with this case, the region will be push back to the queue but the path cost won't be updated and the parent won't be set. |
same as above |
Pros: detail and contrast preservation. Better color transitions Cons: |
Second pass |
Once the Q is empty , we check the regions flags for being recolored or not. We use the same function depends on the design to recolor the uncolored regions. |
- |
recolor the regions didn't recolored by shortest path |
If there wasn't any match between the pairs when signs are the same, the color will be return with the same index as the parent.