With the ubiquity of cellular phones, mobile applications with 2D barcodes have drawn a lot of attentions in recent years. All previous works assume that barcodes are printed on flat surfaces. However, we find out that the above assumption does not hold and indicate that the barcodes on distorted surfaces tend to deteriorate the accuracy of recognition. Therefore, we propose an effcient and effective algorithm to rectify and extract 2D barcode in a distorted image. Compared with previous approaches, our algorithm is of high quality with higher accuracy of the barcode recognition.