【Python OPENCV】 Color spaces

 

Let's take a closer look at color spaces

You may have remembered we talked about images being stored in RGB (Red Green Blue) color Spaces. Let's take a look at that in OpenCV.

First thing to remember about OpenCV's RGB is that it's BGR (I know, this is annoying)

Let's look at the image shape again. The '3L'


[ ]

Let's look at the individual color levels for the first pixel (0,0)


[ ]
12 19 34
(415, 622, 3)

Let's see what happens when we convert it to grayscale


[ ]
(415, 622)
23

It's now only 2 dimensions. Each pixel coordinate has only one value (previously 3) with a range of 0 to 255


[ ]
21

Another useful color space is HSV

Infact HSV is very useful in color filtering.


[ ]

Let's now explore lookng at individual channels in an RGB image


[1]

[ ]

[ ]
(415, 622)
You can view a list of color converisons here, but keep in mind you won't ever use or need many of these

Building Bluesky: a Distributed Social Network (Real-World Engineering Challenges)

Bluesky is built by around 10 engineers, and has amassed 5 million users since publicly launching in February this year. A deep dive into no...

Contact Form

Name

Email *

Message *