title: How to fill Matrix with zeros in OpenCV?
body: <p>The code below causes an exception. Why?</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;iostream&gt;
  
  using namespace cv;
  using namespace std;
  
  void main() {
  
      try {
          Mat m1 = Mat(1,1, CV_64F, 0);
          m1.at&lt;double&gt;(0,0) = 0;
      }
      catch(cv::Exception &amp;e) {
          cerr &lt;&lt; e.what() &lt;&lt; endl;
      }
  
  }
  </code></pre>
  
  <p>Error is follows:</p>
  
  <pre><code>OpenCV Error: Assertion failed (dims &lt;= 2 &amp;&amp; data &amp;&amp; (unsigned)i0 &lt; (unsigned)size.p[0] &amp;&amp; (unsigned)(i1*DataType&lt;_Tp&gt;::channels) &lt; (unsigned)(size.p[1]*channels()) &amp;&amp; ((((sizeof(size_t)&lt;&lt;28)|0x8442211) &gt;&gt; ((DataType&lt;_Tp&gt;::depth) &amp; ((1 &lt;&lt; 3
  ) - 1))*4) &amp; 15) == elemSize1()) in unknown function, file %OPENCV_DIR%\build\include\opencv2\core\mat.hpp, line 537
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>If tracing this code, I see that constructor line calls the constructor</p>
  
  <pre><code>inline Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
  </code></pre>
  
  <p>Why? This prototype has 5 parameters, while I am providing 4 arguments.</p>