Ask Your Question

Raligan's profile - activity

2014-12-07 19:09:06 -0500 answered a question RGB vs. BGR

As far as I can tell, BGR vs RGB only seems to matter if you're manipulating pixels directly in your code. So, if you have an image you've made, or if you're coming up with a coloring scheme for your polygons or what have you, you need to worry about it. But given that there's no built in method for checking the formatting, it seems that effectively OpenCV assumes it all is. Whenever you load an image, OpenCV "thinks" of it as being in BGR, even if it's an RGB ppm file. It just loads the first member of the tuple into the third, and vice versa. So, BGR is the default in OpenCV (which is really weird, IMO) and the only time it matters as far as I can tell is if you're fiddling with pixels directly, which should be fairly rare and would explain why the RGB standard is ignored. In fairness, I'm far from a definitive expert on the topic, but this comes from me fiddling with OpenCV for a few weeks trying to get a good handle on it!