Recognize a Photo of a Business Card, Extract Key Information in Python

Many of us don’t carry around traditional wallets these days, which makes storing new business cards a challenge — a challenge easily solved by taking a snapshot of the business card on your phone. Once in digital image format, you can use the Cloudmersive OCR API to recognize & extract key information from the business card with convenient labels such as “PersonName,” “PersonTitle,” “BusinessName,” and much more. You can connect your app in Python using the code below.

First things first, use the below command to install the Python SDK:

pip install cloudmersive-ocr-api-client

After that, you can copy in the callback function. In the second snippet, you’ll need to supply your Cloudmersive API key for authorization where indicated (if you don’t have a key, you can easily get one by creating a free account on the Cloudmersive website).

from __future__ import print_function
import time
import cloudmersive_ocr_api_client
from cloudmersive_ocr_api_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_ocr_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_ocr_api_client.ImageOcrApi(cloudmersive_ocr_api_client.ApiClient(configuration))
image_file = '/path/to/inputfile' # file | Image file to perform OCR on. Common file formats such as PNG, JPEG are supported.
try:
# Recognize a photo of a business card, extract key business information
api_response = api_instance.image_ocr_photo_recognize_business_card(image_file)
pprint(api_response)
except ApiException as e:
print("Exception when calling ImageOcrApi->image_ocr_photo_recognize_business_card: %s\n" % e)

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

3. Longest Substring Without Repeating Characters

.Net Development on the M1 Mac

10 Python project ideas for beginners 2022

Simulating an Arduino in Tinkercad

Showcasing the Top 10 Reasons to Use Cassandra

How To Use Images In Flutter — To The Point

Creating Nested Routes and Resources for Ruby on Rails

Virtual function calls in constructors and destructors (C++)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Detect and Un-rotate a Document Image in Python

Recognize a Photo of a Receipt, Extract Key Business Information in Python

Convert a Scanned Image into Text in Python

Part-of-Speech Tag a String, Filter to Nouns in Python