How to detect vehicle license plates in photos in Salesforce Apex

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.

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

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