OpenCV's early choice of the BGR color space over RGB was primarily due to historical compatibility considerations. The core reasons are as follows:
Continuation of Historical Conventions
OpenCV was originally developed by Intel around 2000. Early versions, designed to be compatible with Intel's internal image processing libraries (such as IPL), directly adopted the BGR format. This format was more common in hardware acceleration and low-level image processing at the time, and some industrial cameras and image acquisition devices also output BGR by default.
Performance Optimization Considerations
In early computer architectures, the BGR format more efficiently utilizes memory alignment and caching mechanisms. Since OpenCV was originally designed for real-time image processing, which is performance-sensitive, the BGR format can reduce memory accesses and improve processing speed on certain hardware.
Differentiation from MATLAB
In early academic research, MATLAB's image processing toolbox used the RGB format. By adopting BGR, OpenCV established a technical distinction, avoiding direct competition while attracting industrial users who demand high-performance processing.
Although modern hardware no longer relies on BGR optimizations, and RGB is more intuitive, OpenCV retains BGR as the default format for backward compatibility. Users can easily convert color spaces through cv2.cvtColor() or explicitly specify RGB input in new code to adapt to different scene requirements. This design reflects the balance between technical heritage and pragmatism.