title: Accessing all pixels in cv::Mat
body: <p>Is this the correct way of accessing all pixels in <code>cv::Mat</code>:</p>
  
  <pre><code>for( row = 0; row &lt; mat.rows; ++row) 
      {
              for ( col = 0; col &lt; mat.cols; ++col) 
              {
  
  
  
              }
      }
  </code></pre>
  
  <p>Or is there a formula method similar to this formula for an <code>IplImage *</code>:</p>
  
  <pre><code>temp_ptr = &amp;((uchar*)(img-&gt;imageData + (img-&gt;widthStep*pt.x)))[pt.y*3];
  </code></pre>