Hello,
Some advice here would be appreciated, been looking at this for a number of weeks.
Error given on Matrix Multiply OpenCV: Core.Multiply() Function Goal: After running SolvePnP doing simple Matrix Multiply with the following matrix dimensions : [3x3]*[3x1] = [3x1]
* Log File Excerpt showing Mat Dumps and Error Message *
LmVSM_k_RotInv : [-0.7248091196769779, -0.6670117571281554, 0.1724733483350253; -0.6771860665621979, 0.7358117890023557, -0.0002059591509784506; -0.1267705458184306, -0.1169458294167176, -0.9850141631950949] LmVSM_k_TransVectNeg : [-7.324298797523894; -2.210406560977737; 1.162266668817123] VmVSM_k_ImgPlaneZeroWorld : [1.429164061258389e-101; 1.840923297268401e-80; 8.843939164890396e+247]
OpenCV(3.4.4) Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array') in arithm_op, file /var/lib/jenkins/workspace/OpenCV/OpenCV - Release/arm/opencv/modules/core/src/arithm.cpp, line 660 Unhandled exception: CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.4) /var/lib/jenkins/workspace/OpenCV/OpenCV - Release/arm/opencv/modules/core/src/arithm.cpp:660: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op']
* Code Snippets *
private Mat VmVSM_k_RotVect = new Mat(3,1,CvType.CV_64F); private Mat VmVSM_k_TransVect = new Mat(3,1,CvType.CV_64F); private Mat VmVSM_k_Rot = new Mat(3,3,CvType.CV_64F); private Mat VmVSM_k_ImgPlaneZeroWorld = new Mat(3,1,CvType.CV_64F); . . . Mat LmVSM_k_RotInv = new Mat(3,3,CvType.CV_64F); Mat LmVSM_k_TransVectNeg = new Mat(3,1,CvType.CV_64F); Mat LmVSM_k_ZerosVect = new Mat(3,1,CvType.CV_64F); . . . /* Initialize Local Matricies for prior to Angle2 calculation / LmVSM_k_RotInv.zeros(3,3,CvType.CV_64F); LmVSM_k_TransVectNeg.zeros(1,3,CvType.CV_64F); LmVSM_k_ZerosVect.zeros(3,1,CvType.CV_64F); . . . / Angle2: Calculate horiz angle between the target perpendicular and the robot-target line */ Calib3d.Rodrigues(VmVSM_k_RotVect, VmVSM_k_Rot); Core.transpose(VmVSM_k_Rot,LmVSM_k_RotInv); Core.scaleAdd(VmVSM_k_TransVect, -1.0, LmVSM_k_ZerosVect, LmVSM_k_TransVectNeg); System.out.println("LmVSM_k_RotInv : " + LmVSM_k_RotInv.dump()); System.out.println("LmVSM_k_TransVectNeg : " + LmVSM_k_TransVectNeg.dump()); System.out.println("VmVSM_k_ImgPlaneZeroWorld : " + VmVSM_k_ImgPlaneZeroWorld.dump()); Core.multiply(LmVSM_k_RotInv, LmVSM_k_TransVectNeg, VmVSM_k_ImgPlaneZeroWorld); (Error here apparently)