Changeset 2132


Ignore:
Timestamp:
Dec 7, 2007, 9:37:12 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Renamed "gray" into "grey" because I'm a fucking pedantic, children- eating, anti-American British-writing French asshole.
Location:
www/study
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • www/study/fig4-1-1.svg

    r1972 r2132  
    6969     inkscape:pageopacity="0.0"
    7070     inkscape:pageshadow="2"
    71      inkscape:zoom="1.979899"
     71     inkscape:zoom="1.4"
    7272     inkscape:cx="248.73373"
    7373     inkscape:cy="140.86645"
     
    400400         x="338.37518"
    401401         y="56.005066"
    402          id="tspan2396">grayscale</tspan>
     402         id="tspan2396">greyscale</tspan>
    403403      <tspan
    404404         sodipodi:role="line"
  • www/study/fig4-1-2.svg

    r1972 r2132  
    296296         x="136.79474"
    297297         sodipodi:role="line"
    298          id="tspan3210">50% gray</tspan></text>
     298         id="tspan3210">50% grey</tspan></text>
    299299    <path
    300300       id="path3212"
     
    439439         x="136.79474"
    440440         y="65.493927"
    441          style="font-size:14.18273544px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#cc7a7a;fill-opacity:1;font-family:Bitstream Vera Serif">50% gray</tspan><tspan
     441         style="font-size:14.18273544px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#cc7a7a;fill-opacity:1;font-family:Bitstream Vera Serif">50% grey</tspan><tspan
    442442         id="tspan3238"
    443443         sodipodi:role="line"
     
    466466         x="150.88538"
    467467         id="tspan3244"
    468          sodipodi:role="line">Gray 0.5</tspan></text>
     468         sodipodi:role="line">Grey 0.5</tspan></text>
    469469    <g
    470470       style="color:#ff0000;fill:none;stroke:#cc7a7a;stroke-width:2.0534265;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:12.32055834, 12.32055834;stroke-dashoffset:0;stroke-opacity:1"
  • www/study/fig4-1-3.svg

    r1975 r2132  
    302302         x="136.79474"
    303303         sodipodi:role="line"
    304          id="tspan3210">22% gray</tspan></text>
     304         id="tspan3210">22% grey</tspan></text>
    305305    <path
    306306       id="path3212"
     
    457457         x="136.79474"
    458458         y="63.493927"
    459          style="font-size:14.18273544px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#cc7a7a;fill-opacity:1;font-family:Bitstream Vera Serif">60% gray</tspan><tspan
     459         style="font-size:14.18273544px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#cc7a7a;fill-opacity:1;font-family:Bitstream Vera Serif">60% grey</tspan><tspan
    460460         id="tspan2225"
    461461         sodipodi:role="line"
     
    477477         x="149.1651"
    478478         id="tspan2229"
    479          sodipodi:role="line">Gray 0.5</tspan></text>
     479         sodipodi:role="line">Grey 0.5</tspan></text>
    480480  </g>
    481481</svg>
  • www/study/index.html

    r2030 r2132  
    6060
    6161<p> This document makes a lot of assumptions, such as the fact that input
    62 images are made of pixels that have either one (gray level) or three (red,
     62images are made of pixels that have either one (grey level) or three (red,
    6363green and blue) values uniformly spread between 0 and 1 (with regards to
    6464human contrast perception). Real life is more complicated than that, but
     
    7878  <li> <a href="part2.html">2. Halftoning patterns</a> </li>
    7979  <li> <a href="part3.html">3. Error diffusion</a> </li>
    80   <li> <a href="part4.html">4. Grayscale dithering</a> </li>
     80  <li> <a href="part4.html">4. Greyscale dithering</a> </li>
    8181  <li> <a href="part5.html">5. Colour dithering</a> </li>
    8282  <li> <a href="part6.html">6. Photographic mosaics</a> </li>
  • www/study/part1.html

    r2112 r2132  
    5353<h3> 1.1. Black and white thresholding </h3>
    5454
    55 <p> Since a grayscale pixel has a value between 0 and 1, a fast method
     55<p> Since a greyscale pixel has a value between 0 and 1, a fast method
    5656to convert the image to black and white is to set all pixels below 0.5
    5757to black and all pixels above 0.5 to white. This method is called
     
    8585not improve tremendously. </p>
    8686
    87 <h3> 1.2. Grayscale thresholding </h3>
     87<h3> 1.2. Greyscale thresholding </h3>
    8888
    8989<p> Better results can be achieved with a slightly bigger palette. Here is
     
    101101</p>
    102102
    103 <p> Using this method, shades of gray are evenly used. However, the global
     103<p> Using this method, shades of grey are evenly used. However, the global
    104104error is far from optimal, as the following graphs show: </p>
    105105
  • www/study/part3.html

    r2131 r2132  
    2929</div>
    3030<div style="float: right;">
    31    <a href="part4.html">&gt;&gt;&gt; Grayscale dithering</a>
     31   <a href="part4.html">&gt;&gt;&gt; Greyscale dithering</a>
    3232</div>
    3333<div style="text-align: center;">
     
    294294</div>
    295295<div style="float: right;">
    296    <a href="part4.html">&gt;&gt;&gt; Grayscale dithering</a>
     296   <a href="part4.html">&gt;&gt;&gt; Greyscale dithering</a>
    297297</div>
    298298<div style="text-align: center;">
  • www/study/part4.html

    r2130 r2132  
    3535</div>
    3636
    37 <h2> 4. Grayscale dithering </h2>
     37<h2> 4. Greyscale dithering </h2>
    3838
    39 <p> At first sight, generalising dithering to three gray scales seems pretty
    40 straightforward: just add gray 0.5 in the middle of the palette and dither
    41 pixels in the [0, 0.5] range with black and gray, and pixels in the [0.5, 1]
    42 range with gray and white. Here are two different results with 4×4 Bayer
     39<p> At first sight, generalising dithering to three grey scales seems pretty
     40straightforward: just add grey 0.5 in the middle of the palette and dither
     41pixels in the [0, 0.5] range with black and grey, and pixels in the [0.5, 1]
     42range with grey and white. Here are two different results with 4×4 Bayer
    4343ordered dithering and with serpentine Floyd-Steinberg error diffusion: </p>
    4444
     
    5858
    5959<p> Unfortunately the result is not as good as expected: the white pattern
    60 on Lenna’s cheeks is visually disturbing, and there is a lot of 0.5 gray in
     60on Lenna’s cheeks is visually disturbing, and there is a lot of 0.5 grey in
    6161the image. Also, the whole image looks darker than with pure black-and-white
    6262dithering, but these previous dithering results looked a lot brighter than
     
    6868
    6969<p> If you are reading this document on a computer screen, you may have
    70 noticed that the black and white 50% pattern was closer to a 0.73 grayscale
     70noticed that the black and white 50% pattern was closer to a 0.73 greyscale
    7171(left) than to the intuitively expected 0.5 value (right). If you are reading
    7272a printed copy, it might be a different matter. </p>
     
    7777</p>
    7878
    79 <p> The mapping linking grayscale steps to intensities is called <b>gamma
     79<p> The mapping linking greyscale steps to intensities is called <b>gamma
    8080correction</b>. An approximate law for gamma correction is given as
    8181<i>I = v<small><sup>γ</sup></small></i> where <i>v</i> is the coded colour
     
    83830% and 100%) and <i>γ</i> is the gamma. A pattern made of even-numbered
    84840%-intensity pixels and 100%-intensity pixels has an intensity of 50% by
    85 definition. But the corresponding grayscale depends on the gamma value. </p>
     85definition. But the corresponding greyscale depends on the gamma value. </p>
    8686
    8787<p> Most modern computer systems use the sRGB gamma model close to the law
     
    9494<p> Éric Brasseur wrote <a href="http://www.4p8.com/eric.brasseur/gamma.html">a
    9595pretty comprehensive essay</a> about why on a computer screen a 50% black and
    96 white pattern should be scaled down to a gray value of 0.73 instead of 0.5 and
     96white pattern should be scaled down to a grey value of 0.73 instead of 0.5 and
    9797how major computer graphics software totally misses the point. Conversely, it
    98 clearly means that a gray value of 0.5 should not be emulated with a 50%
     98clearly means that a grey value of 0.5 should not be emulated with a 50%
    9999dither pattern. </p>
    100100
    101101<p> The following figure shows the gamma curve for the naïve three-colour
    102 grayscale gradient we saw above (red curve) compared to the two-colour
     102greyscale gradient we saw above (red curve) compared to the two-colour
    103103gradient (blue curve). Two major observations can be made: the new curve is
    104104far closer to a perfect, linear gradient, but there is a singularity in the
     
    113113
    114114<ul>
    115   <li> Choose a different middle gray value, for instance choosing gray 0.73
     115  <li> Choose a different middle grey value, for instance choosing grey 0.73
    116116       will cancel the singularity and match the two-colour gradients we have
    117117       been using so far. This is not always possible if the output palette
    118118       is fixed. </li>
    119   <li> Don’t place the gray value at the middle of the gradient, for instance
     119  <li> Don’t place the grey value at the middle of the gradient, for instance
    120120       a value of around 25% intensity will again match the previous two-colour
    121121       gradients. </li>
  • www/study/part5.html

    r2130 r2132  
    2626
    2727<div style="float: left;">
    28    <a href="part4.html">Grayscale dithering &lt;&lt;&lt;</a>
     28   <a href="part4.html">Greyscale dithering &lt;&lt;&lt;</a>
    2929</div>
    3030<div style="float: right;">
     
    3838
    3939<p> Dithering colour images means dithering three-dimensional elements (RGB
    40 pixels) instead of one-dimensional gray values. It is very complex and
    41 depends on the output media even more than grayscale dithering. </p>
     40pixels) instead of one-dimensional grey values. It is very complex and
     41depends on the output media even more than greyscale dithering. </p>
    4242
    4343<h3> 5.1. Separate-space dithering </h3>
     
    5555<p> It is made of the eight possible red/green/blue combinations made of 0.0
    5656and 1.0 values. So one way of dithering an image using this palette is to
    57 convert the image into three grayscale images (separating the red, green and
     57convert the image into three greyscale images (separating the red, green and
    5858blue channels), dither each subimage to two colours separately and recombine
    5959the images into three channels. </p>
     
    8585
    8686<div style="float: left;">
    87    <a href="part4.html">Grayscale dithering &lt;&lt;&lt;</a>
     87   <a href="part4.html">Greyscale dithering &lt;&lt;&lt;</a>
    8888</div>
    8989<div style="float: right;">
  • www/study/study.py

    r2130 r2132  
    9393(w, h) = lenna512.size()
    9494
    95 # Image 1: grayscale conversion
     95# Image 1: greyscale conversion
    9696# Read the compression FAQ [55] for the rationale behind using the green
    9797# channel (http://www.faqs.org/faqs/compression-faq/part1/section-30.html)
     
    108108    lenna512bw = Image("lenna512bw.png")
    109109   
    110 # Image 2: 50% grayscale
     110# Image 2: 50% greyscale
    111111# Image 3: 50% scaling
    112112if chapter(0):
     
    134134    lenna256 = Image("lenna256.png")
    135135
    136 # Create a 32x256 grayscale gradient
     136# Create a 32x256 greyscale gradient
    137137if chapter(0):
    138138    gradient256bw = Image((32, 256))
     
    873873##############################################################################
    874874if chapter(4):
    875     print "Chapter 4. Grayscale dithering"
     875    print "Chapter 4. Greyscale dithering"
    876876
    877877# Output 4.0.1: 4x4 Bayer dithering, 3 colours
     
    938938    test402(gradient256bw, ERROR_FSTEIN, True).save("grad4-0-2.png")
    939939
    940 # Pattern 4.1.1: gamma-corrected 50% gray, black-white halftone, 50% gray
     940# Pattern 4.1.1: gamma-corrected 50% grey, black-white halftone, 50% grey
    941941if chapter(4):
    942942    dest = Image((240, 80))
Note: See TracChangeset for help on using the changeset viewer.