Accelerate the frequency of Border Checkpoints using Cognitive Services

It has been just two weeks since I started going Saudi Arabia almost 3-4 times a week. The King Fahd Causeway (which is a bridge between Kingdom of Saudi Arabia and Kingdom of Bahrain) was architect to bring enormous amount of opportunities between two countries. Thousands of people (in about 30,000 cars minimum), like me and my colleagues travel back and forth on daily basis to serve their occupational purposes.

During these days, I witnessed different type of situations at the border; traffic jams, rush, custom check-ups and much more. Being a technology enthusiast, I always try to find out the room for improvements in real life chores / processes and how efficiently those improvements can serve the purpose without deviating from their objective.

As you may be aware, there are different stages when you’re passing through the border checkpoints. You need to get your passport stamped, get yourself clear from customs of one country and then follow the similar security checks on the other side.

Cognitive Services can play a vital role in accelerating these procedures.

From facial recognition of the person to the custom vision of his passport to the auto number plate recognition of his car including other productive outcomes can be obtained using Cognitive Services.

According to what I think is missing in most of the checkpoints is the tendency of ANPR (Automatic number-plate recognition) therefore, I thought to highlight the ease and advantage over the manual process where an immigration officer reads the car and manually insert the same into the system to generate a receipt. This process, however, can easily be automated using ANPR / ALPR libraries / APIs.

For the sake of simplicity and to brief you how easy is it to implement such cases, I have developed one prototype which would just take a photo as soon as immigration officer would hit the capture button and then that image will be processed and sent to the ANPR API for number plate recognition. It would then return a response with all the relevant details out of which a number can be sent to other system which generates the receipt for the car.

Image Courtesy: MPSS

I modified the existing Camera Sample of UWP apps hence you may find a lot of irrelevant code details. However, the part which I have touched has the comments with my name on it. Should you wish to add more features to it, feel free about it.

var apiUri = new Uri("");

//load the image byte[] into a System.Net.Http.ByteArrayContent
var imageBinaryContent = new ByteArrayContent(bytes);

//create a System.Net.Http.MultiPartFormDataContent
var multipartContent = new MultipartFormDataContent();

//make the POST request using the URI enpoint and the MultiPartFormDataContent
var result = await client.PostAsync(apiUri, multipartContent);
var response = await result.Content.ReadAsByteArrayAsync();
var responseString = Encoding.UTF8.GetString(response, 0, response.Length);
var jsonResult = JsonConvert.DeserializeObject(responseString);

if(jsonResult?.results?.Count() > 0)
      return jsonResult.results[0].plate;

This code is up and live on my github repository for you to contribute. Happy coding!

Disclaimer: This post is just for my learning and to update the respective solution providers who’re working on such software. This post has nothing to do with the processes, procedures or standards of any specific country.

Related Posts