Abstract Automatically classifying terrain such as rocks, sand and gravel from images is a challenging machine vision problem. In addition to human designed approaches, a great deal of progress has been made using machine learning techniques to perform classification from images. In this work, we demonstrate the first known use of Cartesian Genetic Programming (CGP) to this problem. Our CGP for Image Processing (CGP-IP) system quickly learns classifiers and detectors for certain terrain types. The learned program outperforms currently used techniques for classification tasks performed on a panorama image collected by the Mars Exploration Rover Spirit.