An angled optical pattern is decoded. To decode an optical pattern imaged at an angle, an area of interest of an image is received. A start line and an end line of the optical pattern are estimated. Corners of the optical pattern are localized. A homography is calculated based on the corners. And a scanline of the optical pattern is rectified based on the homography.