Gray Step

Math Root When the boundary between two gray gradients is covered you do not see the change in brightness from one side to the other.

By examining the finite difference derivatives of the grayness of the postcard we can get an idea of what the eye and brain do when they analyze an image.

Here is a good image of a gradient in darkness from left to right, repeated twice. A linear gradient in gray from light to dark repeated twice. Click for an enlarged image.

Define the grayness of a piece of the gray step postcard, G, as the fraction of the incident light that is absorbed by the postcard.

The grayness of the gray step postcards increases linearly from G = 0.1 at the left edge to G = 0.2 at the center. Then it repeats, changing abruptly to G = 0.1 and increasing to G = 0.2 again at the right edge.

Define a coordinate system with x = 0 at the center of the postcard.
The postcard exists for -10 cm < x < 10 cm. Gray percent versus distance on the postcard.

Write an equation for grayness versus x.
x >0 G = 0.1 + x * (0.1/10)
x< 0 G = 0.2 + x * (0.1/10)

There is a problem at x = 0 where there is a discontinuity.

The cones on the retina have a finite size. This allows us to get around the mathematical difficulty at the origin by creating a table of values of grayness versus position. We can then perform finite difference mathematics on the table.

Let's break the gray step postcard into 1 cm wide regions and write the average grayness in each region: A one centimeter wide region at -5 cm or -0.05 m is 15% gray.

Make a table for every 1 cm wide interval.

 x -0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 G 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.15 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2

Now let's compute the central finite difference derivative.

dG/dx = (G(x+1) - G(x-1))/((x+1)-(x-1)) = (G(x+1) - G(x-1))/2 m-1

For Example dG(-.09)/dx = (.12-.1)/2 = .02/2 = .01 m-1

 x -.1 -0.09 -.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 .1 G --- 0.01 ..01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 -0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ---

This table does not contain enough information to allow the retina to determine which side is dark and which side is bright. It shows that there is an edge in the center.

Let's press on and take the second finite difference derivative by applying the same rule over again.

d2G/dx2 = d(dG/dx)/dx = (dG(x+1)/dx - dG(x-1)/dx)/((x+1)-(x-1))

 x -.1 -.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 .09 .1 G .--- --- 0 0 0 0 0 0 0 -0.025 0 0.025 0 0 0 0 0 0 0 --- ---

Here we can see that to the left of the center the cells are all the same, 0, except for the one cell just left of the center which is -.025. While to the right the cells are also 0 except for the one that is +.025. These positive and negative values of the second derivative give each side of the gray step its dark or light value. The zeros give each side a constant shading.