title: matrix multiplication in Opencv using c++
body: <p>Hi all I'm a rookie in C++ and Opencv as well. Kindly help me out on this.</p>
  
  <p>I have a function (cv::aruco::estimatePoseSingleMarkers(markerCorners, markerLength, camMatrix, distCoeffs, rvecs,tvecs); that gives pose of the marker w.r.t camera.
  I used a for loop to print out the values of tvecs from the function.</p>
  
  <blockquote>
    <p>tvecs: [-0.0240248, 0.0161165, 0.052999]</p>
  </blockquote>
  
  <p>When I print the size of tvecs it says the size is 1. But I think itś 1x3.</p>
  
  <p>My requirement is to perform a matrix multiplication of the above mentioned tvces and a matrix of size [3x3].
  How do I do this?
  The following is the piece of code:</p>
  
  <pre><code>// Get frame and convert to OpenCV Mat
  int openCVDataType=CV_8UC3;
  cv::Mat image(cv::Size(pRequest-&gt;imageWidth.read(),pRequest-&gt;imageHeight.read()),openCVDataType,pRequest-&gt;imageData.read(),pRequest-&gt;imageLinePitch.read() );
  
  //Undistort
  cv::remap(image, imageUndist, map1, map2, CV_INTER_LINEAR);
  
  //ArUco detection
  cv::aruco::detectMarkers(imageUndist,dictionary,markerCorners,markerIds,detectorParams,rejectedCandidates);
  
  if(markerIds.size() &gt; 0) {
  
    cv::aruco::estimatePoseSingleMarkers(markerCorners, markerLength, camMatrix, distCoeffs, rvecs,tvecs);
  
  
    for(unsigned int d = 0;d&lt;markerIds.size();d++) {
  
      cout&lt;&lt;"tvecsss: "&lt;&lt;tvecs[d]&lt;&lt;endl;
      cout&lt;&lt;"tvecs: "&lt;&lt;tvecs[d].t()&lt;&lt;endl;
  
      cv::Mat rotMat;               
      cv::Rodrigues(rvecs[d],rotMat);
      rotMat = rotMat.t();
      cout&lt;&lt;"rotMat: "&lt;&lt;rotMat&lt;&lt;endl;
      cout&lt;&lt;"translation: "&lt;&lt;-tvecs[d]*rotMat&lt;&lt;endl;
    }
  </code></pre>
  
  <p>There's an error when I multiply tvecs[d]*rotMat. This the error:</p>
  
  <pre><code>mat.inl.hpp:1274: error: (-215:Assertion failed) data &amp;&amp; dims &lt;= 2 &amp;&amp; 
  (rows == 1 || cols == 1) &amp;&amp; rows + cols - 1 == n &amp;&amp; channels() == 1 in 
  function 'operator cv::Vec&lt;_Tp, m&gt;'
  </code></pre>