How to calculate distance between camera and image?
C++ Code or Open CV code to calculate the distance between camera and image
My Goal is to write a function in C++ or Open CV that can determine the distance between a camera and an image.
- Using a simple axis camera . . .
- Get a piece of cardboard, put some reflective tape on the cardboard, as an image target. Use 4" wide retroreflective tape material (3M 8830 Silver Marking Film)
- Place the cardboard with reflective tape at a known distance.
- Take an image: have the camera face the cardboard, and take a photo image.
Based on that image, determine the distance. How far is the camera from the image?
Write a function that will calculate the distance.
More specifically, write a function that the program would pass the camera image to, And you go into that image, tell me how far away the cardboard target item is from the camera.
I am new to writing code, can anyone help me with code for this distance calculation?