How do I represent grid patterns with a dither matrix?

AI Thread Summary
The discussion focuses on representing grid patterns using a dither matrix, specifically addressing confusion around the concepts of truncation and intensity in pixel values. The participant references a problem statement and attempts to clarify the relationship between pixel intensity and the dither matrix. Key equations involve calculating indices using modular arithmetic and understanding how to apply the dither matrix to determine pixel values based on intensity errors. The participant seeks further clarification on terms like trunc, floor, and ceil, as well as their implications for displaying images with dithering. Overall, the conversation highlights the complexities of implementing dither matrices in image processing.
s3a
Messages
814
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.
 
Back
Top