OpenCV uses BGR instead of RGB format

In daily development and communication, we are used to arranging the color channels of pictures according to RGB (red, green, blue). Bored to idle, when playing the convolutional neural network model, I found that OpenCV did not read the pictures in this order. Curiously search why OpenCV uses BGR instead of RGB. See this blog post: Why does OpenCV use BGR color format .

Read this blog post carefully, the author is using the matplotlibexplicit OpenCV read in the picture, and found the picture display is very strange.
The original picture is as follows:

Use OpenCV to read the results displayed on matplotlib

The author asked why the OpenCV author used the BGR format instead of RGB at a conference. The answer he got was summed up for historical reasons. The article also uses a very funny story to illustrate this fact: why the standard rail gauge in the United States is 4 feet 8.5 inches . Those interested in this story can read the original blog post.

So what is the historical reason: the reason why
early developers used BGR as a color space is that the BGR format at that time was more popular between camera manufacturers and software providers. E.g. In Windows, when using COLORREF to specify the color value, use BGR format 0x00bbggrr.

Published 943 original articles · Like 136 · Visit 330,000+

Guess you like

Origin blog.csdn.net/weixin_36670529/article/details/105166140