Displaying an Image
Learn about the RGB model and how to display an image in Python.
We'll cover the following
A bit about the RGB model
Computer graphics often use the three primary colors of light to create other colors. The primary colors are red, green, and blue and using them this way is known as the RGB model. RGB colors usually have values of 0–255, where 0 means the color isn’t present at all, and 255 means all the colors are present. The RGB values for the color red are:
255, 0 , 0
Because the first part (red) is 255 and the other two (blue and green) are zero, this is an example of pure red. We can create other colors by changing the values of the three colors. For example, pink is:
255, 51, 255
Red is 255, green is 51, and blue is 255. We can find these values by Googling RGB codes.
Note: OpenCV inverts the RGB pattern. So instead of RGB, we have BGR (blue, green, red).
Get hands-on with 1400+ tech skills courses.