How do I represent grid patterns with a dither matrix?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
s3a
Messages
828
Reaction score
8

Homework Statement


PROBLEM STATEMENT:
"Represent the grid patterns in the figure with a dither matrix."
(Figure: https://www.docdroid.net/OMLUX5v/figure.pdf )

ANSWER (FROM MY BOOK):
http://www.wolframalpha.com/input/?i={{0,2},{3,1}}

Homework Equations


Matrix_element_where_dot_should_be_printed_or_something_like_that = D_n(i,j)

i = x mod n

j = y mod n

The Attempt at a Solution


The closest I seem to get to understand how to do the problem from my book is with page 12 (of 15) from a document I found online ( https://www.cs.princeton.edu/courses/archive/fall00/cs426/lectures/dither/dither.pdf ), but I don't understand what trunc(x,y) and P(x,y) are, and I suspect I(x,y) means the intensity at a point (x,y), but what that means, more specifically, is beyond my current understanding.

I'm VERY confused, so any input that could help me fully understand how to do the problem from my book would be GREATLY appreciated!

P.S.
If you want more information from me for anything, just let me know.
 
Physics news on Phys.org
Looking at the code for ordered dither on page 12:
The range of the pixel values and what exactly trunc, floor and ceil do isn't too clear.

i = x mod n
j = y mod n

the image is divided in nxn squares. Each of these squares is combined with the nxn dither matrix.
i and j become the column and row number of the pixel in the small square that it belongs to.
e = I(x,y) - trunc(I(x,y))
I(x,y) is the intensity of the pixel at x,y. It seems to be a real number in the range from 0 to 4 if you want to use the 2x2 dither matrix displayed here.
I think trunc(I(x,y)) should be the same as floor(I(x,y)) and this would mean to round down the intensity to a value that can be displayed without dithering.
for the 1-bit dither that only uses black and white displayed in the images trunc() should always give 0.
e, the error is the difference between the intensity you want and the truncated intensity.
if e > D(i,j) then P(x,y) = ceil(x,y) else P(x,y) = floor(x,y)
if the error is bigger than the value you look up in the dither matrix, then use the intensity rounded up. If it's not, use the intensity rounded down.
for an 1-bit dither ceil(x,y) would produce black, and floor(x,y) would produce white.