Extract camera position
Hi
Given a set of points in world coordinates lying around a field, how do i extract the POSITION in XYZ of the camera ?
Help thanks
EDIT: double cv::calibrateCamera gives me 90 error and my camera positions are wrong.
Position of camera 1 is [87.32213358065832; 31.93220642490884; 13.05887540297087]
I input the into the function following the tutorial http://docs.opencv.org/2.4/doc/tutori...
calibrateCamera(World_Coords, Image_Coords, Size(1920,1080), cameraMatrix, distCoeffs, rvecs, tvecs, CV_CALIB_FIX_K4 | CV_CALIB_FIX_K5);
The points in world_coords and Image_coords are arranged such that they correspond to each other.
Then i use rodrigues() to extract the 3x3 rot matrix then the camera position = - rot_matrix.transpose() * tvec.
But I am not getting the right camera position. Can i send the code and data to anyone ?
Camera positions
87.3212582849046; 31.93218648966307; 13.06565020386278]
[88.33600161820506; 36.45175643361132; 13.09339437945696]
[52.67469116679835; 32.05365845570439; 12.67307503062286]
[53.09438819350136; 36.17409639334836; 12.70318338140262]
[9.268389455871184; 35.52733695765274; 14.36430399165124]
[9.21543336317054; 38.71223919680707; 14.1736490348868]
EDIT: i changed to CV_CALIB_FIX_ASPECT_RATIO and the error has dropped to 19. how do i make it drop to ~1. help
If you have for each point the 3D coordinate in the world frame and the corresponding 2D coordinate in the image frame and you have the intrinsic parameters of the camera, you can use solvePnP to estimate the camera pose.