Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Distance calculation b/w camera and object using matlab

Status
Not open for further replies.

annna

Member level 2
Joined
Jun 17, 2010
Messages
52
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
pak
Activity points
1,682
Hi,
Can anybody help me. I want to measure the distance between an object and the camera through which the snap has been taken. I've came to know that using the actual area of the object I can calculate the distance using some technique. All I want to know is that technique. And if one can tell me any other solution then it will be great.........................
 

Matlab has a similar demo in the image processing toolbox. Check it out. But I am not sure if you can measure actual distance on standard scale like meter, but you can measure in pixels. But using some projections and mathematical calculation you maybe able to calculate the actual distance.
 
I am able to calculate the distance b/w two points in an image in pixels. But i want to calculate the one b/w object and camera. All I need are those mathematical calculations which you are talking about Can you please explain a little bit about them
 
For that you need a scale which specifies that 1 pixel = " how many " meters , ( like 1 pixel= .001meters) something like that. If you have that , it should just basic calculations from which you can find the distance.
 

I could not understand what you are trying to say. If I know that ratio which you mentioned above (I know DPI 'Dots Per Inch' of the image), I can know the distance from one point to another (i.e: I have to make any reference for distance measurement), But in the case of camera there is no reference for me. I will be very thankful to you if you can let me understand the technique which is going on in your mind. Hope I have not asked any silly question......
 

It is possible take geometric informatios about objects using camera.
But you need a lot of pictures, and also compute some camera parameters ( like, focal distance ).
This can be achieved by only one camera getting picures on diffrent known positions, or also several static cameras.
This method is called 3D Reconstruction.

Once all that geometry are configurated, the input images will generate a modeled spatial object in witch is possible measure the distance you want.

Take a look here :
**broken link removed**

+++
 
Last edited:

What if I know the approximate distance between the camera and object and have to calculate the actual distance can i do this using one image.
 

Hi,

You did'nt ask any silly question. The basic problem is that you need some sort of prior to start with. And what Andre has mentioned in his reply is the same thing. You need multiple parameters come up with some prior to work it out. So like in his reply you need to get the scale of the focus and things like that. The basic used in 3D reconstruction is the Triangulation method , which is also used to calculate the distance of the moon from the earth , and things like that. But you cannot start with a single image and go to find the actual distances unless you have a prior knowledge or some given parameters.
I have worked on satellite images and there we are given the scale of image pixels and things would be more easy.
 

okay I got it I'll be back with all that stuff soon....................
 

ok, hi

i think what you need is perspective transformation. Since your subject is in 3D and your image is 2D the mapping done by the camera is not one to one..buts its many to one (more specifically 3 to 2) the image as such does not provide with the Z coordinate or depth information( that is what you want to find out-the distance of object from the camera).

The perspective Transformation is the method that most image processing and now a days."3D" TV sets use to introduce the depth information in the display.
https://www.youtube.com/watch?v=VYgFAdvDpzM&feature=relmfu
use the above link
it provides the basics of perspective transformation.
32_1305305441.png
82_1305305441.png
8_1305305441.png
12_1305305441.png
80_1305305441.png


you need to either know a reference distance from which you can extract any other distance information or you need to know all the variables eg: focal length etc.
then you have the formulae , substitute and get the result.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top