Blog
Augmented Commerce

How to Measure Pupillary Distance and Use It for Online Try-On and Ophthalmology

Pupillary distance (PD) or interpupillary distance is a key metric for many eye-related applications. In recent years, it has left the opticians’ cabinets and made its way to smartphones. As an enthusiast of technology behind it and someone who wears glasses, I couldn’t be happier. So in this article I will explain the importance of this metric, show how to measure pupillary distance on any device with a camera, and how to get this technology for your own app.

[navigation]

TL;DR:

  • Pupillary distance means how far the centers of pupils are from each other.
  • PD is important for positioning prescription lens and AR/VR headsets, as well as virtual try-on and product recommendations.
  • Banuba's virtual PD ruler works by creating a 3D mesh of a person's face and gauging the distance between the correct vertices.
  • You can integrate this tool into your app by following the instructions below.

What is pupillary distance?

PD measures how far the centers of your pupils are from each other. Opticians use it to position the lens of prescription glasses so that they align properly. Otherwise, the person wearing them would suffer from hazy vision or headaches.

Today there are other applications for it as well.

  • AR/VR headset positioning. The principle is the same: if the lens are aligned correctly, the user gets the best experience, otherwise they can have unpleasant symptoms.
  • Online glasses try-on. If we know PD, we can use it to calculate other parameters, e.g. the user’s head size. This means when the user wants to order the glasses they tried on virtually, they will get the frame that will sit just right. 
  • Recommendations. Suggest the products that would both fit the buyer and be in stock. This would further improve the customer satisfaction.

How PD measurement works

I’m a programmer, not an optician. So in this section, I will talk about how to measure pupillary distance with a smartphone, tablet, or other handy camera. This is something I generally like – I’d rather do these measurements at home instead of going somewhere. However, it wasn’t as convenient as I liked.

For example, one app required that someone else takes a picture of me already wearing my prescription glasses. Then I needed to manually mark the specific points (e.g. the center of the pupils, corners of the lenses, etc. Ain’t nobody got time for that, especially given that at that point I lost my prescription glasses while travelling around Europe. 

Another virtual PD measurement app needed me to hold a credit card to my forehead when taking a picture, making me feel like an idiot and wonder if they want my private information. I understand the necessity – the standardized size of a plastic card is a good reference point for virtual pupillary distance measure, but I still wish I didn’t need to take these additional steps. 

Still other virtual PD ruler worked great, but required new iOS devices with advanced cameras that not many people have.

This was a good motivation to create a more convenient technology.

Here’s how it works in Banuba Face AR SDK

      1.  Face detection and tracking. The specially trained neural networks locate the face in the image, video frame, or live stream and monitor its movement. If you want more details, see the dedicated article.
      2.  Landmark detection. Traditionally, face-related apps track landmarks – points that indicate the position of facial features. We monitor 68 of them to ensure accuracy.
      3.  3D mesh generation. At this stage, the system creates an accurate 3D model of the person’s face. It is 100% inclusive and applies to every human being.
      4.  PD calculation. The software measures the distance between the vertices for centers of the person’s pupils to ensure precision.


A user can handle the virtual pupillary distance measure on their own and with one hand. No additional items are required. Moreover, this feature combines well with camera-to-face distance measurement, which has already been successfully used in an app that helps diagnose vision issues in orphans.

How to get pupillary distance measurement for your app

Developing virtual PD measurement from scratch would require a lot of time, money, and technical know-how. Instead, you can integrate an SDK – a ready-made module with all the necessary functionalities. It takes under a week (sometimes under an hour) to merge with your project, and the yearly license costs far less than it would take to develop similar feature yourself.

Besides virtual pupillary distance measure, it could also include other things that your customers might like:

Moreover, Banuba Face AR SDK has a 14-day free trial (just like with virtual PD measurement itself, no credit card is required) so you can explore it at your own pace.

Getting it is simple. First, send us a message through a contact form below.

Enhance Your Store With Virtual Try-On  Get free trial

Then follow the integration instructions:

Conclusion

Pupillary distance is a core metric for online stores and ophthalmology practices. Measuring it on people’s phones used to be (and in many cases still is) clunky and inconvenient because of referential items, special requirements, and other user experience issues. With Banuba's virtual PD measurement integrated, your app can determine PD in a manner convenient to your customers. Start a free trial and see for yourself.

Top