The whole idea.
To a computer a picture is a grid of pixels, and every pixel is three numbers: how much red, green
and blue, each from 0 to 255. There is nothing else in the file. Every trick on this page is plain
arithmetic on those numbers — and so is everything a CNN does with a picture.
Where the CNN comes in.
A color picture goes into a CNN as three grids of numbers, one per channel. Shrinking it first is
normal: big photos are resized to something like 224×224 before they go in. Brightness
and contrast changes are used during training, applied at random, so the network learns that a
darker photo of a cat is still a cat.
Things worth trying:
1. Pixels are numbers: click anywhere on the left picture to zoom in there. The cat's green
eye is the same three numbers in every pixel; at the edge of the eye they change in a step.
2. Gray scale: a pure blue pixel (0, 0, 255) and a pure green one (0, 255, 0) both come out
85 with a plain average. Weighted, blue gives 29 and green 150 — and blue does look darker to
us. Flip between the two and watch the sky of the House.
3. Channel split, House, Blue: the sky is bright (216) and the red roof
almost black (44). Switch to Red and the roof (160) is brighter than the sky (111).
4. Downsize, Rings, 2×: Skip pixels draws new circles at the left and
right edges that are not in the picture. Average each block fades them to a soft gray.
5. Brightness & contrast: the formula is (old − 128) × contrast + 128 +
brightness — a slope and an intercept, y = mx + b again. Push the brightness up and every
pixel past 255 is cut to 255, so the bright parts all become the same white and their detail is gone.