坦白说这是一个历史遗留原因,早期在照相机制造商和软件供应商中流行BGR颜色格式,opencv为了迎合当时开发者的习惯使用了BGR。令人哭笑不得的是,今天这个时代又流行起了RBG格式,opencv庞大的船在BGR的路上已经难以掉头了,只好这样将就着。或许,将来的也会有那么一天,有人问我们,为什么开发的软件都是用RBG格式。
Why did they choose BGR color space in OpenCV ?
The reason the early developers at OpenCV chose BGR color format is that back then BGR color format was popular among camera manufacturers and software providers. E.g. in Windows, when specifying color value using COLORREF they use the BGR format 0x00bbggrr.
BGR was a choice made for historical reasons and now we have to live with it. In other words, BGR is the horse’s ass in OpenCV.
reference:https://www.learnopencv.com/why-does-opencv-use-bgr-color-format