title: Change pixel data of a rectangle in opencv
body: <p>I used the rectangle array below to loop faces detected by Haar Classifier:</p>
  
  <pre><code>for( int i = 0; i &lt; (objects ? objects-&gt;total : 0 ); i++ )
  {
      CvRect* r = ( CvRect* )cvGetSeqElem( objects, i );
      cvRectangle( frame, cvPoint( r-&gt;x, r-&gt;y ), cvPoint( r-&gt;x + r-&gt;width, r-&gt;y + r-&gt;height ),colors[i%1]);
  
  }
  </code></pre>
  
  <p>But I want to change the pixel data of each face detected in the classifier i.e. change the values of pixels of each rectangle in:</p>
  
  <pre><code>CvRect* r;
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>for( int i = 0; i &lt; (objects ? objects-&gt;total : 0 ); i++ )
  {
   r[i];
  for(int j = r-&gt;y; j &lt; r-&gt;y + r-&gt;height; j++)
  {
      for(int k = r-&gt;x; k &lt; r-&gt;x + r-&gt;width; k++)
      {   
      frame-&gt;imageData[k*3] = 0;    
          frame-&gt;imageData[k*3+2] = 0;
       }
       }
       }
  </code></pre>
  
  <p>to keep only G channel of the face but it is saying that the variable 'r' is not declared.</p>