title: Basic matrix multiplication in OpenCV for Android
body: <p>I'm probably being incredibly stupid here but I'm having trouble doing some basicaly Mat multiplication using OpenCV for Android.</p>
  
  <p>I have two Mat's both of the same type, <code>CV_64F</code></p>
  
  <p><code>mat1</code> has size: 3 rows, 3 cols<br>
  <code>mat2</code> has size: 3 rows, 1 cols</p>
  
  <p>I want to multiply them to give the product <code>mat3</code> of size 3 rows, 1 cols.</p>
  
  <p>I've tried using:<br></p>
  
  <pre><code>Mat mat3 = new Mat(3, 1, CvType.CV_64F);
  Core.multiply(mat1, mat2, mat3);
  </code></pre>
  
  <p><br>
  But I get an error:</p>
  
  <blockquote>
    <p>CvException
    [org.opencv.core.CvException:/home/andreyk/OpenCV2/trunk/opencv_2.3.1.b2/modules/core/src/arithm.cpp:1253:
    error: (-209) 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 void cv::arithm_op(const
    cv::_InputArray&amp;, const cv::_InputArray&amp;, const cv::_OutputArray&amp;,
    const cv::_InputArray&amp;, int, void (*<em>)(const uchar</em>, size_t, const
    uchar*, size_t, uchar*, size_t, cv::Size, void*), bool, void*)</p>
  </blockquote>
  
  <p><br>What am I doing wrong?<br><br>
  Thanks for any help in advance.</p>
  
  <p><strong>EDIT:</strong><br>
  If it helps, the 3x3 matrix <code>mat2</code> is the result of <code>Imgproc.getPerspectiveTransform</code> and the rest of the code is as follows:</p>
  
  <pre><code>Mat mat1 = new Mat(3, 1, CvType.CV_64F);
  mat1.put(0, 0, 2.0);
  mat1.put(1, 0, 0.5);
  mat1.put(2, 0, 1.0);
  
  Mat mat3 = new Mat(3, 1, CvType.CV_64F);
  Core.multiply(mat2, mat1, mat3);
  </code></pre>