Why OpenCV use the BGR format ? - jinwooklim/my-exp GitHub Wiki

BGR to RGB

rgb = cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB)
rgb = bgr[:, :, ::-1]

The Reason

Value : 0x123456
Value : 0xBBGGRR (24bit) → 0x00BBGGRR (Unsigned 32bit, for memory efficiency)

  1. Big endian : Write the MSB first
    → 0x123456
    → 0x00BBGGRR
  2. Little endian : Write the LSB first
    → 0x563412
    → 0xRRGGBB00