title: cvErode Error- Unknown Array Type
body: <p>I am trying to perform an erosion of a JPEG image after converting the image to YCrCb image space. Using the following code</p>
  
  <pre><code> YCrCbMin.val[0] = 0;
   YCrCbMin.val[1] = 131;
   YCrCbMin.val[2] = 80;
  
   YCrCbMax.val[0] = 255;
   YCrCbMax.val[1] = 185;
   YCrCbMax.val[2] = 135;
  
   imshow("img",Img);// Img is the JPEG image I load off the disk. 
   waitKey(0);
  
   Mat YCrCbImg;
   cvtColor(Img, YCrCbImg, CV_BGR2YCrCb);
  
   Mat erodedImg;
   inRange(YCrCbImg, YCrCbMin, YCrCbMax, erodedImg);
  
   Mat InterMediateImg     = YCrCbImg;
   IplConvKernel* element  = new IplConvKernel();
  
   element-&gt;nCols      = 12;   element-&gt;nRows      = 12;   element-&gt;anchorX    = 6;    element-&gt;anchorY    = 6;
  
    cvErode(&amp;erodedImg, &amp;InterMediateImg, element, 1);
    element-&gt;nCols      = 6;    element-&gt;nRows      = 6;    element-&gt;anchorX    = 3;    element-&gt;anchorY    = 3;
    cvDilate(&amp;InterMediateImg, &amp;erodedImg, element, 2);
  </code></pre>
  
  <p>On the first erosion, I get the following error as shown in the screenshot.</p>
  
  <p><img src="https://i.stack.imgur.com/5dprg.png" alt="Error Image"></p>
  
  <p>I have used the following image as input</p>
  
  <p><img src="https://i.stack.imgur.com/5sUhp.jpg" alt="index.jpg"></p>
  
  <p>What am I doing wrong here??</p>