【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

I Quit AeroMedLab

Watch now (2 mins) | Today is my last day at AeroMedLab ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *