Effective bit depth of averaged pixels?

  • Thread starter Thread starter leright
  • Start date Start date
  • Tags Tags
    Bit Depth
Click For Summary

Discussion Overview

The discussion revolves around determining the effective bit depth of color values in the red channel when averaging multiple pixels, specifically focusing on how many unique average values can be generated from a set of pixels, each with a defined number of color levels. The conversation includes mathematical reasoning and exploration of concepts related to combinations, permutations, and the impact of noise on effective bit depth.

Discussion Character

  • Exploratory
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant seeks to calculate the number of effective bits in the red channel of averaged pixels, noting that a single 24-bit pixel has 256 levels per color channel.
  • Another participant suggests that averaging pixels can increase effective bit depth, gaining one additional bit for every pair of identical bit depth numbers averaged.
  • There is a discussion about the difference between permutations and combinations, with one participant clarifying that the total number of unique combinations is more complex than simply calculating permutations.
  • One participant provides a formula for combinations with repetition, indicating that the total number of unique averages can be derived from the number of pixels and levels.
  • Concerns are raised about rounding averages to integers, which could limit the number of unique values to 256 regardless of the number of pixels averaged.
  • Another participant proposes that the number of unique averages is equivalent to the number of unique sums, suggesting that doubling the number of pixels increases the bit depth by one bit.
  • One participant emphasizes the need to consider the lowest and highest possible average values and the increment in average values to determine the total number of possible averages.

Areas of Agreement / Disagreement

Participants express differing views on the calculation of unique averages and the impact of noise on effective bit depth. There is no consensus on a definitive method for calculating the number of unique averages or the implications of rounding.

Contextual Notes

Participants acknowledge the complexity of the problem, with some noting that assumptions about rounding and noise could significantly affect the outcomes. The discussion includes various mathematical approaches and interpretations that remain unresolved.

leright
Messages
1,317
Reaction score
19
Hello,

I am trying to figure out how many effective bits of color depth are carried in the red channel of a number of averaged pixels.

For instance, a single 24 bit pixel carries 8 bits per color channel (RGB). Therefore, you can generate 2^8 = 256 red levels, 2^8 = 256 green levels, and 2^8 = 256 blue levels. Now, let's say you take n pixels and average them together. The total number of averaged red values is the number of combinations you can generate with n pixels, where each pixel can carry 256 possible red values. If I knew the number of combinations I could generate then I could easily determine the number of "effective" bits. 2^b = # of combinations, where b is the number of effective bits.

So, how many combinations of red channel values can I generate with n pixels, where each pixel can have 256 different red channel values?
 
Engineering news on Phys.org
you might want to be more specific by what you mean by "effective". every time you average a pair of numbers with identical bit depth, you gain one additional bit (just as would happen when you add two numbers of the same bit depth). if you are thinking of noise level resulting in quantization, then every time you average four numbers with the same bit depth, then you gain one more effective bit even though there are actually two extra bits. in that case, the LSB is a noisy bit.
 
For n pixels of 256 levels each, we would have 256n possible combinations.

If you simply take the sum of the n pixel values, you would have 256*n possible values.
 
Redbelly98 said:
For n pixels of 256 levels each, we would have 256n possible combinations.

I don't think this is correct. This is the total number of permutations. for instance, if we have 4 pixels and we have the values 1, 6, 20, and 35, then all of the permutations of these 4 numbers are identical combinations and therefore produce the same average. I need the total number of unique combinations, not the total number of permutations.
 
I always get "permutations" and "combinations" mixed up. Sorry.
Yes, 256^n is the number of permutations. For example, [1,6,20,25] is different than [6,1,20,25]If you really want the total number of combinations, that is more difficult because we are allowed to repeat numbers. From the "combinations with repetition" section near the bottom of this page:
http://www.mathsisfun.com/combinatorics/combinations-permutations.html ,
I get that the answer is

[tex] \frac{(256+4-1)!}{4! \ (256-1)!} = \frac{256 \cdot 257 \cdot 258 \cdot 259}{4!}[/tex]

or more generally, for n pixels:

[tex] \frac{(256+n-1)!}{n! \ (256-1)!}[/tex]

However:
If you are just going to take the average of the pixel values, there are actually
255*n + 1
possibilities. In this case different combinations will produce the same result. For example, [1,6,20,25] and [2,5,20,25] have the same sum (52) or average (13).

The possible averages, if it is 4 pixels, are:
0
0.25
0.5
0.75
1
...
254
254.25
254.5
254.75
255

That's 255*4+1 or 1021 possible values. The formula I gave in post #3, 254*n, was an approximation to this when I hadn't thought things through thoroughly.

Hope that helps clear things up.
 
Redbelly98 said:
I always get "permutations" and "combinations" mixed up. Sorry.
Yes, 256^n is the number of permutations. For example, [1,6,20,25] is different than [6,1,20,25]If you really want the total number of combinations, that is more difficult because we are allowed to repeat numbers. From the "combinations with repetition" section near the bottom of this page:
http://www.mathsisfun.com/combinatorics/combinations-permutations.html ,
I get that the answer is

[tex] \frac{(256+4-1)!}{4! \ (256-1)!} = \frac{256 \cdot 257 \cdot 258 \cdot 259}{4!}[/tex]

or more generally, for n pixels:

[tex] \frac{(256+n-1)!}{n! \ (256-1)!}[/tex]

However:
If you are just going to take the average of the pixel values, there are actually
255*n + 1
possibilities. In this case different combinations will produce the same result. For example, [1,6,20,25] and [2,5,20,25] have the same sum (52) or average (13).

The possible averages, if it is 4 pixels, are:
0
0.25
0.5
0.75
1
...
254
254.25
254.5
254.75
255

That's 255*4+1 or 1021 possible values. The formula I gave in post #3, 254*n, was an approximation to this when I hadn't thought things through thoroughly.

Hope that helps clear things up.

yeah, I need to determine how many unique averages I can generate with n pixels and 256 values per pixel. that looks right. However, is there a more rigorous way to prove the above expression, other than listing the possibilities?

Thanks.
 
You're welcome.

You probably realize this, but if the average gets rounded off to an integer, then you're stuck at 256 no matter how many pixels are averaged.
 
Redbelly98 said:
You're welcome.

You probably realize this, but if the average gets rounded off to an integer, then you're stuck at 256 no matter how many pixels are averaged.

yeah, I realize that. The average isn't being rounded.

How do I prove, without listing possibilities, how many unique averages there are?

Thanks
 
leright said:
The average isn't being rounded.

How do I prove, without listing possibilities, how many unique averages there are?

i think that number is simply the number of levels per pixel times the number of pixels being averaged. the number of unique averages there are is the same number as the number of unique sums.

so every time you double the number of pixels being averaged, you increase the bit depth by one bit if, by "bit depth", you mean the number of bits necessary to not lose any information. but if you quadrupled the number if pixels averaged, even though you might think you need to add two bits to the bit depth, the LSB is noisy and you've really only increased your number of meaningful bits by 1. that is an issue of noise and information theory.
 
  • #10
rbj said:
i think that number is simply the number of levels per pixel times the number of pixels being averaged. the number of unique averages there are is the same number as the number of unique sums.

so every time you double the number of pixels being averaged, you increase the bit depth by one bit if, by "bit depth", you mean the number of bits necessary to not lose any information. but if you quadrupled the number if pixels averaged, even though you might think you need to add two bits to the bit depth, the LSB is noisy and you've really only increased your number of meaningful bits by 1. that is an issue of noise and information theory.

ok, I am confused now. I will think about thi some more and get back with you. :)

Thanks everyone for your help.
 
  • #11
You need three numbers to get the total number of possible average values:

1. The lowest possible average value
2. The highest possible average value
3. The increment in possible average values.

For #1, use the least possible pixel value for all pixels (=0)
For #2, use the highest possible value for all pixels (=255)
For #3, how much does the average change if you increase the value of one pixel element by 1, and leave the remaining pixels the same? Answer: 1/n

From these, you can get the total number possible.
 
  • #12
This makes sense.

Thanks

Redbelly98 said:
You need three numbers to get the total number of possible average values:

1. The lowest possible average value
2. The highest possible average value
3. The increment in possible average values.

For #1, use the least possible pixel value for all pixels (=0)
For #2, use the highest possible value for all pixels (=255)
For #3, how much does the average change if you increase the value of one pixel element by 1, and leave the remaining pixels the same? Answer: 1/n

From these, you can get the total number possible.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 30 ·
2
Replies
30
Views
3K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K