title: OpenCV: Matrix Iteration
body: <p>I am new to OpenCV. I am trying to use iterator instead of "for" loop, which is too slow for my case. I tried some codes like this: </p>
  
  <pre><code>MatIterator_&lt;uchar&gt; it, end;
  for( it = I.begin&lt;uchar&gt;(), end = I.end&lt;uchar&gt;(); it != end; ++it)
  {
      //some codes here
  }
  </code></pre>
  
  <p>My question here is: how can I convert a for loop like: </p>
  
  <pre><code>for ( int i = 0; i &lt; 500; i ++ )
  {
      exampleMat.at&lt;int&gt;(i) = srcMat&gt;.at&lt;int&gt;( i +2, i + 3 )
  }
  </code></pre>
  
  <p>into iterator mode? That is, how can I do the "i +2, i + 3" in iterator form? I only can get the corresponding value by " *it " I think, but I couldn't get its counting number. 
  Many thanks in advance. </p>