They don’t.

You’re interpreting the raw data wrong. According to the PiCamera documentation, the Pi’s 10-bit raw data is encoded as 5 bytes in the following manner:

The Pi’s Bayer array is BGGR. So the first four bytes contain the most significant bits (bits 10–3) of the blue, green1, green2, and red sensels, respectively. The fifth byte of data packs the least-most significant bits of each of the sensels into that single byte. But that means blue’s low bits are shifted by 6 bits (equivalent to multiplying by 64), green1’s low bits are shifted by 4 bits (same as multiplying by 16), green2’s low bits are shifted by 2 bits (multiplying by 4).

So, if you just try to view the raw data in a regular image viewer (which you shouldn’t), you’ll see a each 5-byte block as a row of 5 pixels:

- a pixel representing the raw blue top 8 bits
- a pixel representing the raw green1 top 8 bits
- a pixel representing the raw green2 top 8 bits
- a pixel representing the raw red top 8 bits
- a pixel representing the lowest 2 bits of each of the BGGR sensels, in binary weighted order.

Thus, when interpreted (i.e., viewed) as a single pixel, that 5th byte highly magnifies the low-order bits of blue’s data, and also magnifies green1’s low-order bits.

Because you took a mostly dark image, the first 4 bytes of data, representing the high-order bits of each of the BGGR sensels, is mostly black / dark gray. There are probably several nonzero values in the data, but not much beyond probably bit 3 or 4. Most of the noise was in bits 1 and 2 for each sensel, which all just happen to be packed into that 5th byte of the raw data.

So, to your question, “Why do Bayer images of total darkness contain stripes?”, they don’t. The vertical stripes are just an accident of showing an array of data structures as an image. The raw data is not meant to be viewed directly, without parsing or processing it first. I suggest using a utility such as `raspiraw`

, or use Picamera and follow their Raw Bayer data captures guide.