RGB Pixel Matrix

Digital Vision

Computers don't see shapes or colors directly. They see massive spreadsheets of numbers labeled R, G, B.

Hover over a pixel to inspect its DNA.

Vision without a Brain

Before AI, how do computers store images? A digital image is nothing but a grid of colored dots called Pixels.
Continue

1. The Pixel DNA (RGB)

Every pixel is made of 3 lights: Red, Green, Blue. By mixing them, we get millions of colors. (255, 0, 0) is Pure Red. (255, 255, 0) is Yellow.
Continue

2. The Matrix of Numbers

Behind the colors, there are just numbers from 0 to 255. 0 means 'Light Off'. 255 means 'Light Maximum'. An image is literally a Spreadsheet.
Continue

3. Seeing in Black & White

Color is complex. Often, we simplify images to Grayscale (Intensity only). Formula: Gray = 0.3*R + 0.59*G + 0.11*B. This removes color distraction.
Continue

Inspect the Matrix

Click buttons to see the different channels (Red, Green, Blue). Hover over pixels to see their exact component values.
Continue

Loading an Image

Using Python (OpenCV) to read image data.

vision.py
import cv2
import numpy as np

# 1. Load Image
# Matches the interactive grid above
image = cv2.imread('apple_pixel_art.png')

# 2. Inspect shape
print(image.shape)
# Output: (3, 3, 3) 
# -> (Height, Width, Channels[BGR])

# 3. Get pixel value at top-left
pixel = image[0, 0]
print(pixel)
# Output: [50, 200, 50] (Greenish)
Reading Pixels
AlgoAnimator: Interactive Data Structures