How to detect vehicle license plates in photos in Salesforce Apex

Cloudmersive
1 min readFeb 20, 2020

--

Today’s quick tutorial will get you up to speed on setting up license plate detection with Apex.

Let’s initiate the process with downloading our API client and extracting it into the folder of your project. With that complete, we can move on to implementation of the function recognizeDetectVehicleLicensePlates:

SwagRecognizeApi api = new SwagRecognizeApi();SwagClient client = api.getClient();// Configure API key authorization: ApikeyApiKeyAuth Apikey = (ApiKeyAuth) client.getAuthentication('Apikey');Apikey.setApiKey('YOUR API KEY');Map<String, Object> params = new Map<String, Object>{'imageFile' => Blob.valueOf('Sample text file\nContents')};try {// cross your fingersSwagVehicleLicensePlateDetectionResu result = api.recognizeDetectVehicleLicensePlates(params);System.debug(result);} catch (Swagger.ApiException e) {// ...handle your exceptions}

And that’s it. The API will do the rest of the work for us and return the location and text of any license plates in the photo, as well as a confidence rating for said text.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet