Secret project molens. Now that I am able to do pattern matching, uploading via http post request, having the server configured to translate the molecule to 3D coord, I need a way to project the 3D particles in to the reality.
To do that, I will need to use Calib3D.solvePnP(MatofPoint3F objPoints, Matofpoint2F imgPoints, Mat cameraMatrix, MatofDouble distortionCoef, Mat rVec, Mat tVec)
objPoints and imgPoints are easy enough. They represent the coordinates of the points in the 3D plane and 2D plane respectively. distortionCoef can be useful, but I am just going to let it be null and default to zero. The problem is cameraMatrix. The doc sugguests taking a series of checkerboard images to allow the camera to calibrate. I did not like the idea for two reasons. 1) I cannot reasonably expect an average user to be bothered with camera calibration. 2) CPU intensive. 3) Where in the world are they going to print the pattern?
I think I will find an average cameraMatrix, and use it that way. To find out more about the camera calibration matrix, I stumbled across this video:
More shenanigans. The method:
solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec)
even though the doc said:
distCoeffs – Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
passing null to the function result in program crashing, with no explanation.