Digital cameras apply a non-linearity to the captured sensor values prior to quantisation. This process is known as perceptual linearisation and ensures that the quantisation rate is approximately proportional to human sensitivity. We propose an adaptive in-camera non-linearity that ensures that the detail and contrast visible in the processed image match closely with the perception of the original scene. The method has been developed to emulate basic properties of the human visual system including contrast normalisation and the efficient coding of natural images via adaptive processes. Our results are validated visually and also quantitatively by two image quality metrics that model human perception. The method works for still and moving i...