# Changeset 1892 for wwwTweet

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

Unmodified
Removed
• ## www/study/index.html

 r1887

This document makes a lot of assumptions, such as the fact that input images are made of pixels that have either one (gray) or three (red, green and blue) intensity values comprised between 0 and 255. Real life is even more blue) intensity values comprised between 0 and 1. Real life is even more complicated than that, but this is beyond the scope of this document for now.

• the input image: is it a photograph? a vector drawing? a composition of both?)
• of both?
• the target media: is it a computer screen? if so, what are the size and the position of the pixels? is it a printed document? if so, be optimised for both targets?
• the quality requirements: for instance, can contrast be raised for a more appealing result at the expense of accurracy? a more appealing result at the expense of accuracy?
• the allowed computation time: do we need 50fps or is a 10-second computation acceptable?
• 1.1. The naïve approach: thresholding

Since a grayscale pixel has a value between 0 and 255, a fast method to convert the image to black and white is to set all pixels below 127 (50%) to black, and all pixels above 128 to white. This method is called

Since a grayscale pixel has a value between 0 and 1, a fast method to convert the image to black and white is to set all pixels below 0.5 to black and all pixels above 0.5 to white. This method is called thresholding and, in our case, results in the following image:

Not that bad, but we were pretty lucky: the original image’s brightness was rather well balanced. A lot of detail is lost, though. Different results can be obtained by choosing “threshold values” other than 50%, for instance 40% or 60%, resulting in a much brighter or darker image:

can be obtained by choosing “threshold values” other than 0.5, for instance 0.4 or 0.6, resulting in a much brighter or darker image:

This looks promising. Let’s try immediately on Lenna! We shall leave pixels below 33% to black and pixels above 66% to white, but pixels inbetween will be painted with the finest pattern:

pixels below 0.33 to black and pixels above 0.66 to white, but pixels inbetween will be painted with the finest pattern:

Already better. But we can do even better using additional patterns such as the 25% and the 75% halftone patterns:

Here is the application to Lenna, using the 0-0.2, 0.2-0.4, 0.4-0.6, 0.6-0.8 and 0.8-1 ranges for black, white and the three patterns:

Note: See TracChangeset for help on using the changeset viewer.