Find the distance between object and camera

2 views (last 30 days)
BA Lamine
BA Lamine on 5 Feb 2015
Commented: BA Lamine on 5 Feb 2015
Hello every body,
I'm in the last year of my school study. My engineer project is to find the distance between object and camera by running the software in the Raspberry PI. I find some programs that allow me to recongnize the object that I look for and I have an algorithm which calculate the position of the pixel center in the object in matlab. This algorithm is now running on my PC by capturing the image with my Raspberry PI. Now I have two question, Is it possible to compile some matlab function by using it in Simulink for running them in simulink. And the second is how to calculate the exact distance between camera and the object.
PS : Matlab code is not running in the Raspberry Pi just simulink model. So I want to compile some function in Image processing to use them in my simulink model.
Thank you in advance. I think my questions or my explanations were clear. Thank you for helping.

Answers (1)

Alessandro Masullo
Alessandro Masullo on 5 Feb 2015
Calculating the distance between an object and a camera in not an easy task. In theory, you would need two different cameras because one camera only gives you two-dimensional information.
If you only have one camera, you need some tricks to evaluate that distance. If the object (or the camera) is moving you can use some perspective rules to guess the object distance (an object very far away as the background do not change its size while you move the camera, while objects really close to it change their size).
  1 Comment
BA Lamine
BA Lamine on 5 Feb 2015
Thanks you for your fast answer. I have two camera (RaspberryPI camera and USB camera) but I just used one of them (USB Cam). I think when I use two camera, the time to calculate the distance will be very very slow. I try to track a robot and the robot will go fast. If the time to calculate is long, the system is not be helpfull for the robot.
Thank you.

Sign in to comment.

Categories

Find more on ROS Log Files and Transformations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!