# Question about "imagePoints" parameter for solvePnP() function

I am new to OpenCV and try to use solvePnP to compute camera pose from knowns 3D points. I am quite confuse about the second parameter, imagePoints, of this function. Should it by integer? According to the definition, imagePoints are the pixel coordinate of query image. However, when I use ORB method to detect feature points, I notice that 2/3 of generated feature points have floating values of 2D points. I am not sure if this is the reason that I can not get correct answer of camera pose? Furthermore, should the value of imagePoints argument be normalized with image size before passing to solvePnP? Can someone please help me solve the puzzle. Thanks,

edit retag close merge delete

Sort by ยป oldest newest most voted

Image points are perfectly fine as floating point in Point2f. They can be anywhere in the frame, so if you have 1920x1080, you can give points from x = 0 through 1920 and y = 0 through 1080.

Are you making sure that your image points correspond to the 3d points? That is, point 0 in your 3d points should be point 0 in your image points and so forth. SolvePnP needs them in order, with matches for all of them.

more

Hi, Telragramm: Thank you for your prompt and helpful reply. I am not quite follow you on "point 0 in your 3d points should be point 0 in your image points and so forth"? The thing I am doing is, I took a panorama first and try to match a live photo with that panorama. Of course, I will assign some pseudo 3D coordinates to points in the panorama. So, since live picture will be only a small portion of this panorama, how can I align point 0 of assigned 3D coordinates with point 0 on live image? Can you more specific? Thanks in advance for your reply.

( 2017-02-24 00:37:46 -0500 )edit

You have to have a list of only the 3d points that have a match in your 2d points. So only those ORB points that have a feature match.

( 2017-02-24 17:36:50 -0500 )edit

Hi, Tetragramm: Thank you for your reply. I do not understand your comments. I do assign a 3D value to each feature point on the reference panorama image(train image). Is this what you meant? I try to find out current live picture match which portion of the panorama. So, you can image that the panorama is much bigger than a live picture and it is very difficult to align point 0 of assigned 3D coordinates with point 0 on live image. Please advise. Thanks,

( 2017-02-25 19:51:14 -0500 )edit

Yes, it is hard. But that's what you need to do.

( 2017-02-25 20:15:59 -0500 )edit

Official site

GitHub

Wiki

Documentation