170k views
3 votes
each of the pixels can take 1 of 16 gray lvels raning from 0(white) to 15(black). the rule is gray levels of two adjacent pixels cannot differe by more than one. how many of 256 possible assignments of gray levels to two adjacent satisfy this rule?

1 Answer

3 votes

There are 706 possible assignments of gray levels to two adjacent pixels that satisfy the given rule.

Let's consider the gray levels of two adjacent pixels as A and B. The rule states that the absolute difference between A and B cannot be more than one. There are three possible cases:

∣A−B∣=0 (the gray levels are the same)

∣A−B∣=1 (the gray levels differ by one)

Now, let's count the number of possibilities for each case:

Case

∣A−B∣=0: There are 16 choices for both A and B (since they can be any of the 16 gray levels). So, there are

16×16=256 possibilities for this case.

Case

∣A−B∣=1: There are two sub-cases for this:

a. A<B: In this case,

A can be any of the 15 gray levels from 0 to 14, and

B can be any of the 15 gray levels from 1 to 15. So, there are

15×15=225 possibilities for this sub-case.

b. A>B: Similarly,

A can be any of the 15 gray levels from 1 to 15, and

B can be any of the 15 gray levels from 0 to 14. Again, there are

15×15=225 possibilities for this sub-case.

Now, add up the possibilities for both sub-cases of

∣A−B∣=1:

225+225=450.

Finally, sum up the possibilities for both cases:

256+450=706

So, there are 706 possible assignments of gray levels to two adjacent pixels that satisfy the given rule.

User Bardi Harborow
by
7.1k points