title: Using CV_MAT_ELEM for modifying CvMat* pixels
body: <p>I am trying to create a kernel used for the Filter2D function. That function expects the kernel to be in CvMat format.</p>
  
  <p>How do I access elements of the CvMat? I have the following code, which gives a compiler error.</p>
  
  <pre><code>inline void plot(CvMat* mat, int x, int y, float c)
  //plot the pixel at (x, y) with brightness c (where 0 ≤ c ≤ 1)
  {
      CV_MAT_ELEM(mat,float,y,x) = MIN(c,1); //The error occurs at this line
  }
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <blockquote>
    <p>error C2228: left of '.data' must have class/struct/union
    error C2228: left of '.ptr' must have class/struct/union
    error C2228: left of '.step' must have class/struct/union</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>