I want to build an App that calculate the distance between pupil of eye of a person
When I googled it, I found a way to calculate the distance using magnetic strip of the credit or debit card.
Now let suppose i have image of a person holding credit card, how to calculate length of magnetic strip of card and distance between the pupil in the image
Any kind of help will work
Thanks in advance
This method would be useful if you know the distance between the pupils of a person in pixels, and you're trying to convert it to a physical unit like inches or mm. A credit card is 85.60 × 53.98 mm. The magnetic strip is 85.60 mm. So, if you see that the length of the strip is 43 px for example, you'd be able to calculate the scale as:
85.60 mm / 43 px = 1.99 mm/px
Then, if you saw that the distance between the pupils was 22 px, you could multiply that with the ratio to find the physical distance:
22 px * 1.99 mm/px = 43.8 mm
You can use the same method to figure out the distance using any other reference of a known length. For example, if you saw a tree that you knew was 12 feet high, you could use the same sort of calculation to figure out the height of something else in the picture.
One thing to remember is the angle the photo was taken at might change the proportions. If you're looking at something from a far distance or if you're using two distances that are parallel to the plane of the camera, you're fine. If you're looking at things that are angled relative to the camera's lens, the distances won't be quite proportional, due to perspective. For example, in this picture of a house taken at an angle, it looks a lot taller on one end than the other. Small angles won't change your calculation too much.
All of this assumes that you have a distance for the edge of the credit card or a distance between the two eyes in pixels first. That gets into image recognition, and unfortunately, I can't help you there. Once you have those distances in pixels, you can use this calculation to get distances in physical units.