When I run projectPoints function using kotlin code below with most simple inputs I get what I believe is incorrect answer. Did I miss something?
I get the following result:
(x,y,z)= [{0.0, 1.0, 1.0}, {0.0, 1.0, 5.0}, {0.0, 1.0, 10.0}]
(u,v)= [{0.0, 78.5398178100586}, {0.0, 19.73955535888672}, {0.0, 9.966865539550781}]
should be
(u,v)=[{0.0, 100.0}, {0.0, 20.0}, {0.0, 10.0}]
fun main(args : Array<String>) { setDllLibraryPath("C:/aaa_eric/code/lib/x64") System.loadLibrary(Core.NATIVE_LIBRARY_NAME) val objectPts3f = MatOfPoint3f(Point3(0.0,1.0,1.0),Point3(0.0,1.0,5.0),Point3(0.0,1.0,10.0)) val imagePts2f = MatOfPoint2f() val rVec = Mat.zeros(3,1, CvType.CV_64F) val tVec = Mat.zeros(3,1, CvType.CV_64F) val mag = 100.0 println(objectPts3f.toList()) //camera matrix, no distortion val kMat = array2Mat(3, CvType.CV_64F, arrayOf(mag, 0.0, 0.0, 0.0, mag, 0.0, 0.0, 0.0, 1.0)) val dMat = Mat.zeros(4, 1, CvType.CV_64F) Calib3d.projectPoints(objectPts3f, imagePts2f, rVec, tVec, kMat, dMat) println(imagePts2f.toList()) }