OpenCV Explanation solvenpn

Can anyone give me more explanation about the opencv function solvepnp()? The opencv documentation says

bool cv::solvePnP   (
        InputArray      objectPoints,
        InputArray      imagePoints,
        InputArray      cameraMatrix,
        InputArray      distCoeffs,
        OutputArray     rvec,
        OutputArray     tvec,
        bool            useExtrinsicGuess = false,
        int             flags = SOLVEPNP_ITERATIVE)

I'm wondering what the objectPoints, imagePoints and cameraMatrix are. I have once calibrated my camera and have a parameter xml file from it, can i use this?

1 answer

  • answered 2017-11-12 21:42 John Sebastian

    It is used when you have for example a 3D model of an object and you have a view of it in the real world, it will give you an approximate position and orientation of the camera towards the object. For example:

    • objectPoints – Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel, where N is the number of points. vector can be also passed here.
    • imagePoints – Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points. vector can be also passed here.

    You can find the rest at this link