In order to solve the defect detection problems of black line and white line of QR Code. According to the linear properties of defect, this paper puts forward a kind of defect detection algorithm based on Hough Transform and vertical projection. Through the experiment testing, the accuracy of algorithm detection reached 98.57%, the average test time is 38.28ms. This algorithm can be transplanted to other types of QR code and industrial on-line detection system.