# Find the location of the camera from a object using opencv

Hi,

I am new to opencv. For my project i am trying to find a way to find the location of the camera (x and y). If I could figure out the locations then it will be possible to figure out which is the best position to capture images to detect the reference point.

Please help me with it. If anyone needs more information please do not hestitate to ask. Thank you in advance.

if what the camera is looking at has targets and you know where the targets are located it is possible to work backwards and figure out where the camera is located.

i am using a raspberry pi camera... i have four triangles on a A0 page as the reference points. I know the center coordinates of the triangle. so what would be the method I could use to find the location.

first you have to calibrate the spherical distortion of the camera. this only has to be done once. See the calib3D examples. Then you would use object recognition to find the triangles. from there you have to use some math and find the camera's location.

see when you mean by spherical distortion... I could use the check board calibration provided by opencv.. Do you have any examples you have done before that i could refer too.

http://docs.opencv.org/doc/tutorials/calib3d/table_of_content_calib3d/table_of_content_calib3d.html#table-of-content-calib3d