How do I represent grid patterns with a dither matrix?

In summary: This would be the same as using trunc(x,y). You could also use a different dither matrix, for example the one that is displayed on the wiki page. It is a little more complicated, but the idea is the same. You could also create a dither matrix for any size nxn. In summary, to represent grid patterns in a figure with a dither matrix, you need to divide the image into nxn squares and combine each square with the corresponding dither matrix. Then, for each pixel, determine the column and row number within the small square it belongs to. Calculate the error between the desired intensity and the truncated intensity, and use this error to determine whether to use the intensity rounded up or down. This
  • #1
s3a
818
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
  • #2
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.
 

1. How do I create a dither matrix for representing grid patterns?

To create a dither matrix, you will need to define the size of your grid, which will determine the dimensions of your matrix. Then, using a mathematical formula, you can fill in the cells of your matrix with numerical values that will create a pattern when overlaid on your grid. There are also online tools and software that can help you generate a dither matrix.

2. What is the purpose of using a dither matrix for grid patterns?

The purpose of using a dither matrix is to create the illusion of a continuous tone image when printing or displaying on a limited color palette. By using a matrix of varying values, the human eye perceives a mixture of colors instead of distinct dots, resulting in a smoother and more realistic image.

3. Can I use a dither matrix for any type of grid pattern?

Yes, a dither matrix can be used for any type of grid pattern, whether it is a simple black and white grid or a more complex colored grid. The values in the matrix can be adjusted to create different patterns and effects, depending on the desired outcome.

4. Is there a specific dither matrix that works best for all grid patterns?

No, there is no one-size-fits-all dither matrix that works for all grid patterns. The optimal dither matrix will depend on factors such as the size and complexity of the grid, the color palette being used, and the desired visual effect. It may require some experimentation and tweaking to find the best dither matrix for your specific grid pattern.

5. Are there any limitations to using a dither matrix for grid patterns?

While dither matrices can be effective in creating the illusion of continuous tones, they do have some limitations. They may not work well for very small or very large grids, and they may not be suitable for printing on certain materials or using certain printing techniques. It's important to do some testing and adjustments to determine if a dither matrix is the best solution for your particular grid pattern.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
11
Views
901
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
23
Views
7K
Replies
36
Views
6K
  • Advanced Physics Homework Help
Replies
7
Views
1K
Replies
3
Views
1K
  • Special and General Relativity
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
997
  • Engineering and Comp Sci Homework Help
Replies
7
Views
904
Back
Top