1. A computer implemented method for producing an adjusted image using message passing, the method comprising performing the following steps: i) receiving an input image that comprises a plurality of pixels, each pixel having an input value and each input value corresponding to one of a number of possible pixel labels; ii) associating each pixel with a node of a graph and one or more cliques of nodes, wherein each possible pixel label is associated with a unary potential, and wherein, for each permutation of possible pixel labels of the pixels associated with the nodes of each clique, a clique potential is associated; iii) for each clique, initialising at least one message between each pair of nodes of that clique; iv) for each node: a) determining, for that node, a respective set of possible pixel labels for which the unary potential is known; b) computing a unary potential of a selected possible pixel label for which the unary potential is unknown and updating the respective set of possible pixel labels to include the selected possible pixel label; c) for each clique to which that node belongs, based on the unary potentials associated with the updated respective set of possible pixel labels, adjusting the clique potential associated with that clique; and d) for each clique to which that node belongs, adjusting, based on the adjusted clique potential associated with that clique, at least one of the messages between that node and the other nodes of that clique; v) repeating step iv) until a convergence criterion is met; and vi) producing an adjusted image having pixel labels determined from the adjusted messages.