We discuss how visual nonlinearity can be optimized for the precise represe
ntation of environmental inputs. Such optimization leads to neural signals
with a compressively nonlinear input-output function the gradient of which
is matched to the cube root of the probability density function (PDF) of th
e environmental input values (and not to the PDF directly as in histogram e
qualization). Comparisons between theory and psychophysical and electrophys
iological data are roughly consistent with the idea that parvocellular (P)
cells are optimized for precision representation of colour: their contrast-
response functions span a range appropriately matched to the environmental
distribution of natural colours; along each dimension of colour space. Thus
P cell codes for colour may have been selected to minimize error in the pe
rceptual estimation of stimulus parameters for natural colours. But magnoce
llular (M) cells have a much stronger than expected saturating nonlinearity
; this supports the view that the function of M cells is mainly to detect b
oundaries rather than to specify contrast or lightness.