Skip to content

why R is not considered in the function cv2.undistortPoints?  #21892

@zhchyang2004

Description

@zhchyang2004
System information (version)
  • OpenCV => 4.5.1
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Spyder
  • Python 3.6.8 :: Anaconda, Inc.

It seems R is not considered in the function cv2.undistortPoints.

pts=np.array([[ 0., 639., 0., 639.],
[ 0., 0., 479., 479.],
[ 1., 1., 1., 1.]])
K=np.array([[536.86303957, 0. , 338.54127669],
[ 0. , 537.17967509, 231.541806 ],
[ 0. , 0. , 1. ]])

R=cv2.Rodrigues(np.array([-.1,.1,.3]))[0]

P=np.array([[538.40307187, 0. , 341.6945076 , 0. ],
[ 0. , 538.40307187, 243.63676453, 0. ],
[ 0. , 0. , 1. , 0. ]])

#only R is given without P
pts_0=cv2.undistortPoints(pts[:2], K, None, None, None)
pts_1=cv2.undistortPoints(pts[:2], K, None, R, None)
print(np.allclose(pts_0, pts_1)) #True

#both R and P are given
pts_2=cv2.undistortPoints(pts[:2], K, None, R, P[:3,:3])
pts_3=cv2.undistortPoints(pts[:2], K, None, None, P[:3,:3])
print(np.allclose(pts_2,pts_3)) #True
temp=np.ones((3,4))
temp[:2]=pts_0.squeeze().T
temp=P[:3,:3]@temp
print(np.allclose(temp[:2]/temp[-1],pts_2.squeeze().T)) #True

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions