tesseract.js
tesseract.js copied to clipboard
Can I get the image Angle through OCR?
I have a requirement that the Angle of the image taken and uploaded by the user may be somewhat tilted. I hope that the Angle of the image can be corrected after the image text is obtained by OCR。thank mail [email protected] I Looking forward to your reply
Take a look at worker.detect()
function which returns the angle
interface DetectData {
tesseract_script_id: number
script: string
script_confidence: number
orientation_degrees: number
orientation_confidence: number
}
Unfortunately the orientation that Tesseract reports pertains to whether the image is rotated 90/180/270 degrees, so is not of much use for determining the angle of a "somewhat tilted" image (say, 5 degrees). The exact angle may be calculated using the .hocr output, however I don't believe there is any existing way to get a single number from Tesseract with this information.