Sunday, August 15, 2021

Python OpenCV: Image Basics

 What are Images?

  • 2-dimensional representation of the visible light spectrum
SourceClick here

How do OpenCV store images?

  • OpenCV used RGB color space by default. However, it actually stores color in the BGR format.
  • Each pixel coordinate (x, y) contains 3 values ranging from 0 to 255 (8-bit)
    • RED
    • GREEN
    • BLUE
  • Mixing those primary colors produces different color spectrum.


Pixel

  • Each image consists of a set of pixels.
  • Pixels are the raw building block of an image.
  • Each pixel in the image represent intensity of the light that appears in the given place in our image.
  • Image resolution of 300 x 200 means there are 300 rows and 200 columns. Overall, there are 300 x 200 = 6000 pixels in the image.
  • Pixels are represent in two ways: grayscale and color
  • Color pixels are normally represented in the RGB color space – one value for the Red component, one for Green, and one for Blue

Grayscale

  • In grayscale, each pixel value has a value between 0 (black) and 255 (white).
  • The values in between 0 and 255 are varying shades of gray, where values closer to 0 are darker and values closer to 255 are lighter.


No comments:

Post a Comment