title: Debug Assertion Failed OpenCv is_block_type_valid(header->_block_use)
body: <p>I am new to Programming using Visual Studio and openCv. I wrote a simple program to display the red channel of an image, but every time i run the code it throws "DEBUG ASSERTION FAILED" error.</p>
  
  <pre><code>#include &lt;opencv2\imgproc\imgproc.hpp&gt;
  #include &lt;opencv2\highgui\highgui.hpp&gt;
  
  #include &lt;iostream&gt;
  
  using namespace std;
  using namespace cv;
  
  int main() {
      Mat image;
      image = imread("C:/Users/siddartha/Pictures/sample.jpg");
      if (!image.data) {
          cout &lt;&lt; "Cannot load image";
          return -1;
      }
      else {
          if (image.channels() &gt;= 3) {
              vector&lt;Mat&gt; rgb;
              split(image, rgb);
              namedWindow("r");
              imshow("r", rgb[0]);
  
          }
      }
      while (1);
      return 0;
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Debug Assertion Failed!
  
  Program: ...sual Studio 2015\Projects\sampleOpenCV\Debug\sampleOpenCV.exe
  File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
  Line: 892
  
  Expression: is_block_type_valid(header-&gt;_block_use)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/mKwlH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mKwlH.png" alt="Error Window"></a></p>