Detect and extract text from images
Stay organized with collections
Save and categorize content based on your preferences.
Optical Character Recognition (OCR)
The Cloud Vision API lets you use optical character recognition (OCR) capabilities
for text detection from images. This means you can use Cloud Vision for
computer vision tasks like image analysis and dense document text detection,
including handwriting extraction.
Cloud Vision API provides two
annotation features that support optical character recognition (OCR):
TEXT_DETECTION detects and extracts text from any image. For example,
a photograph might contain a street sign or traffic sign. The JSON includes
the entire extracted string, as well as individual words, and their bounding
boxes.
DOCUMENT_TEXT_DETECTION also extracts text from an image, but the response
is optimized for dense text and documents. The JSON includes page,
block, paragraph, word, and break information.
If you're new to Google Cloud, create an account to evaluate how
Cloud Vision performs in real-world
scenarios. New customers also get $300 in free credits to run, test, and
deploy workloads.
Set up your Google Cloud project and authentication
If you have not created a Google Cloud project, do so now. Expand this section for instructions.
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator role
(roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
To enable APIs, you need the serviceusage.services.enable permission. If you
created the project, then you likely already have this permission through the
Owner role (roles/owner). Otherwise, you can get this permission through the
Service Usage Admin role (roles/serviceusage.serviceUsageAdmin).
Learn how to grant roles.
To initialize the gcloud CLI, run the following command:
gcloudinit
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator role
(roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
To enable APIs, you need the serviceusage.services.enable permission. If you
created the project, then you likely already have this permission through the
Owner role (roles/owner). Otherwise, you can get this permission through the
Service Usage Admin role (roles/serviceusage.serviceUsageAdmin).
Learn how to grant roles.