title: Accessing rgbMat value in openCV
body: <p>I am trying to print out the values of rgbMat (in the below code) after mapping but getting some error. Can anybody tell me where I am going wrong? It's showing me the following error: </p>
  
  <pre><code>g++ `pkg-config --cflags --libs opencv` line1.cpp 
  l1.cpp: In function ‘int main(int, char**)’:
  l1.cpp:28:50: error: request for member ‘at’ in ‘rgbMat’, which is of non-class type ‘CvMat*’
  l1.cpp:28:58: error: expected primary-expression before ‘&gt;’ token
  l1.cpp:28:62: error: name lookup of ‘x’ changed for ISO ‘for’ scoping
  l1.cpp:28:62: note: (if you use ‘-fpermissive’ G++ will accept your code)
  </code></pre>
  
  <p>I guess I am going wrong in the following line:</p>
  
  <pre><code>  printf("matrix is %u: \n", rgbMat.at&lt;uchar&gt;(y,x));
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>     IplImage* rgb[3];
  
       float L0[]={
           -1,-1,-1,-1,-1,
          0, 0, 0, 0, 0,
          2, 2, 2, 2, 2,
          0, 0, 0, 0, 0,
          -1,-1,-1,-1,-1 };
  
       CvMat*  rgbMat = cvCreateMat(5, 5, CV_32FC1);
  
       for (int y = 0; y &lt; 5; y++)
       {
           for (int x = 0; x &lt; 5; x++)
               cvmSet(rgbMat, y, x, L0[y*5 + x]);
             printf("matrix is %u: \n", rgbMat.at&lt;uchar&gt;(y,x));
       }
  </code></pre>