Ordered Dither: Bayer recurrence relation

Ordered Dither: Bayer recurrence relation

Post by Sven Brau » Wed, 02 Jul 2003 01:58:13



Hi,
i have to implement the Bayer recurrence  relation in c++, but i dont
really know how it works.

The realtion:

T_N(i,j) = [ 4T_N/2                       4T_N/2 + 2U_N/2]
                 [ 4T_N/2 + 3U_N/2       4T_N/2 + U_N/2]

U_N is a N x N matrix where every element is 1.
Can somebody give me tips or explain how to do this?

Greetings,
Sven

 
 
 

Ordered Dither: Bayer recurrence relation

Post by Just d' FAQ » Wed, 02 Jul 2003 07:05:56




Quote:>i have to implement the Bayer recurrence  relation in c++, but i dont
>really know how it works.

>The realtion:

>T_N(i,j) = [ 4T_N/2                       4T_N/2 + 2U_N/2]
>                 [ 4T_N/2 + 3U_N/2       4T_N/2 + U_N/2]

>U_N is a N x N matrix where every element is 1.
>Can somebody give me tips or explain how to do this?

Is this for a class? How is it you know the formula but not what it
means? Please use a monospaced font for 2D equations.

You omit a crucial detail: the 2x2 matrix is

   (2)   [0 2]
  T    = [3 1]

The next larger matrix will double in size to 4x4. It is made of four
blocks, each a 2x2 matrix.

         [ [0 2]  [1 1]     [0 2]  [1 1] ]
   (4)   [4[3 1]+0[1 1]    4[3 1]+2[1 1] ]
  T    = [                               ]
         [ [0 2]  [1 1]     [0 2]  [1 1] ]
         [4[3 1]+3[1 1]    4[3 1]+1[1 1] ]

         [  0  8     2 10 ]
         [ 12  4    14  6 ]
       = [                ]
         [  3 11     1  9 ]
         [ 15  7    13  5 ]

The next matrix will be 8x8, made of four 4x4 blocks based on this
one. And so on.

 
 
 

Ordered Dither: Bayer recurrence relation

Post by Sven Brau » Wed, 02 Jul 2003 21:46:22




Quote:

> You omit a crucial detail: the 2x2 matrix is

>    (2)   [0 2]
>   T    = [3 1]

> The next larger matrix will double in size to 4x4. It is made of four
> blocks, each a 2x2 matrix.

How to get from here:

Quote:>          [ [0 2]  [1 1]     [0 2]  [1 1] ]
>    (4)   [4[3 1]+0[1 1]    4[3 1]+2[1 1] ]
>   T    = [                               ]
>          [ [0 2]  [1 1]     [0 2]  [1 1] ]
>          [4[3 1]+3[1 1]    4[3 1]+1[1 1] ]

here:?

Quote:>          [  0  8     2 10 ]
>          [ 12  4    14  6 ]
>        = [                ]
>          [  3 11     1  9 ]
>          [ 15  7    13  5 ]

> The next matrix will be 8x8, made of four 4x4 blocks based on this
> one. And so on.

That is the problem! How can i do this?
Thx for your help!!
Greetings,
Sven
 
 
 

Ordered Dither: Bayer recurrence relation

Post by Just d' FAQ » Thu, 03 Jul 2003 08:17:42




Quote:>How to get from here:

>>          [ [0 2]  [1 1]     [0 2]  [1 1] ]
>>    (4)   [4[3 1]+0[1 1]    4[3 1]+2[1 1] ]
>>   T    = [                               ]
>>          [ [0 2]  [1 1]     [0 2]  [1 1] ]
>>          [4[3 1]+3[1 1]    4[3 1]+1[1 1] ]

>here:?

>>          [  0  8     2 10 ]
>>          [ 12  4    14  6 ]
>>        = [                ]
>>          [  3 11     1  9 ]
>>          [ 15  7    13  5 ]

>> The next matrix will be 8x8, made of four 4x4 blocks based on this
>> one. And so on.

>That is the problem! How can i do this?

The entry "11" is 4*2 + 3*1. The entry "14" is 4*3 + 2*1. Beyond that,
you're on your own.
 
 
 

Ordered Dither: Bayer recurrence relation

Post by Sven Brau » Sat, 05 Jul 2003 03:21:34


Quote:

> The entry "11" is 4*2 + 3*1. The entry "14" is 4*3 + 2*1. Beyond that,
> you're on your own.

Ok now i understand how the relation works. But i dont know how to
implement it in C++.
I have to know how to return a matrix from a function. Does anybody know how
it works?

Greetings Sven

 
 
 

Ordered Dither: Bayer recurrence relation

Post by Marco Schmid » Sat, 05 Jul 2003 04:26:13


Sven Braun:

Quote:>Ok now i understand how the relation works. But i dont know how to
>implement it in C++.
>I have to know how to return a matrix from a function. Does anybody know how
>it works?

Define your own class that stores a matrix.

Or return an array of primitive values. You could define that the
values of a one-dimensional array are to be interpreted left to right,
top to bottom. Or use a two-dimensional array.

Regards,
Marco

 
 
 

Ordered Dither: Bayer recurrence relation

Post by Sven Brau » Sat, 05 Jul 2003 06:27:26




Quote:> Define your own class that stores a matrix.

> Or return an array of primitive values. You could define that the
> values of a one-dimensional array are to be interpreted left to right,
> top to bottom. Or use a two-dimensional array.

Thx,
How to return a 2D array?
Can you show me a sample source code?
 
 
 

Ordered Dither: Bayer recurrence relation

Post by Just d' FAQ » Sat, 05 Jul 2003 08:15:49




Quote:>Ok now i understand how the relation works. But i dont know how to
>implement it in C++.
>I have to know how to return a matrix from a function. Does anybody know how
>it works?

We all do. At this point you are not asking about graphics algorithms,
you are trying to learn how to program in C++. That is off-topic for
this newsgroup. We welcome your graphics-specific questions here; as
for the rest, try one of these groups