Changeset 1892 for www


Ignore:
Timestamp:
Nov 6, 2007, 12:09:08 AM (13 years ago)
Author:
Sam Hocevar
Message:
  • A word about 25% and 75% patterns.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/study/index.html

    r1887 r1892  
    4141<p> This document makes a lot of assumptions, such as the fact that input
    4242images are made of pixels that have either one (gray) or three (red, green and
    43 blue) intensity values comprised between 0 and 255. Real life is even more
     43blue) intensity values comprised between 0 and 1. Real life is even more
    4444complicated than that, but this is beyond the scope of this document for now.
    4545</p>
     
    5757<ul>
    5858  <li> the input image: is it a photograph? a vector drawing? a composition
    59        of both?) </li>
     59       of both? </li>
    6060  <li> the target media: is it a computer screen? if so, what are the size
    6161       and the position of the pixels? is it a printed document? if so,
     
    6363       be optimised for both targets? </li>
    6464  <li> the quality requirements: for instance, can contrast be raised for
    65        a more appealing result at the expense of accurracy?
     65       a more appealing result at the expense of accuracy?
    6666  <li> the allowed computation time: do we need 50fps or is a 10-second
    6767       computation acceptable? </li>
     
    7070<h3> 1.1. The naïve approach: thresholding </h3>
    7171
    72 <p> Since a grayscale pixel has a value between 0 and 255, a fast method
    73 to convert the image to black and white is to set all pixels below 127 (50%)
    74 to black, and all pixels above 128 to white. This method is called
     72<p> Since a grayscale pixel has a value between 0 and 1, a fast method
     73to convert the image to black and white is to set all pixels below 0.5
     74to black and all pixels above 0.5 to white. This method is called
    7575<b>thresholding</b> and, in our case, results in the following image: </p>
    7676
     
    8181<p> Not that bad, but we were pretty lucky: the original image’s brightness
    8282was rather well balanced. A lot of detail is lost, though. Different results
    83 can be obtained by choosing “threshold values” other than 50%, for instance
    84 40% or 60%, resulting in a much brighter or darker image: </p>
     83can be obtained by choosing “threshold values” other than 0.5, for instance
     840.4 or 0.6, resulting in a much brighter or darker image: </p>
    8585
    8686<p style="text-align: center;">
     
    102102
    103103<p> This looks promising. Let’s try immediately on Lenna! We shall leave
    104 pixels below 33% to black and pixels above 66% to white, but pixels inbetween
    105 will be painted with the finest pattern: </p>
     104pixels below 0.33 to black and pixels above 0.66 to white, but pixels
     105inbetween will be painted with the finest pattern: </p>
    106106
    107107<p style="text-align: center;">
    108108  <img src="test4.png" width="256" height="256" alt="33/66% threshold and 50% halftone" />
     109</p>
     110
     111<p> Already better. But we can do even better using additional patterns such
     112as the 25% and the 75% halftone patterns: </p>
     113
     114<p style="text-align: center;">
     115  <img src="pattern25-75.png" width="512" height="128" alt="25% and 75% patterns" />
     116</p>
     117
     118<p> Here is the application to Lenna, using the 0-0.2, 0.2-0.4, 0.4-0.6,
     1190.6-0.8 and 0.8-1 ranges for black, white and the three patterns: </p>
     120
     121<p style="text-align: center;">
     122  <img src="test5.png" width="256" height="256" alt="20/40/60/80% threshold and 25/50/75% halftones" />
    109123</p>
    110124
Note: See TracChangeset for help on using the changeset viewer.