📅  最后修改于: 2023-12-03 15:05:34.420000             🧑  作者: Mango
Tesseract OCR is a free and open-source Optical Character Recognition engine, developed by Google. It is used to recognize text in images and convert the image into editable text. Tesseract OCR is available for various platforms including Mac, Windows, and Linux. In this article, we will focus on Tesseract OCR for Mac.
Tesseract OCR can be easily installed on a Mac using Homebrew. Homebrew is a package manager for Mac which simplifies the installation process of various software.
Open the Terminal app on your Mac and run the following command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once Homebrew is installed, run the following command to install Tesseract OCR:
brew install tesseract
Tesseract OCR can be used from the command line interface on a Mac. Here are some examples of how to use Tesseract OCR:
To recognize text from an image file, run the following command:
tesseract image.jpg output
This will recognize the text from the image file 'image.jpg' and create a new text file 'output.txt' containing the recognized text.
Tesseract OCR supports recognition of multiple languages. By default, it uses English. To select a different language, use the '-l' option followed by the language code. For example, to recognize text in French, run the following command:
tesseract image.jpg output -l fra
Tesseract OCR uses a default page segmentation mode. Depending on the type of image, it may be necessary to change this mode in order to improve recognition accuracy. To change the page segmentation mode, use the '-psm' option followed by the code for the desired mode. For example, to use the mode for single line text, run the following command:
tesseract image.jpg output -psm 7
Tesseract OCR is a powerful tool that can be used to recognize text from images on a Mac. With support for multiple languages and different page segmentation modes, Tesseract OCR can be used in a variety of applications. By following the installation and usage instructions in this article, you can quickly get started with Tesseract OCR on your Mac.