How to Detect Orientation of a Detected Barcode
Contents
[
Hide
]
Aspose.BarCode allows developers to detect the orientation of a detected barcode by calling the getAngle() method of the BarCodeReader class.
![]() |
---|
Figure: A rotated barcode |
The barcode (rotated 270 degrees) recognized after executing the code that follows is shown in the figure below: |
![]() |
---|
Figure: The detected orientation is 270 degree after example code execution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Instantiate BarCodeReader object | |
BarCodeReader reader = new BarCodeReader("rotatedbarcode.jpg", DecodeType.CODE_128); | |
// read Code128 bar code | |
for (BarCodeResult result : reader.readBarCodes()) { | |
// detect bar code orientation | |
System.out.println("Rotaion Angle: " + result.getRegion().getAngle()); | |
} |