title: OpenCV: Am I declaring matrix correctly?
body: <p>I want to change:</p>
  
  <pre><code>int q[10] ;
  double weight[10];
  
  for ( int i = 0; i &lt; 10; i ++ ) 
  {
      q ++ ;
      weight[i] = 10;
  }
  </code></pre>
  
  <p>into cv::Mat form, so I did it like this:</p>
  
  <pre><code>cv::Mat q = cv::Mat ( 1, 10, CV_8UC3 );
  cv::Mat w = cv::Mat ( 1, 10, CV_8UC3 );    
  
  for ( int i = 0; i &lt; 10; i ++ )
  {
      uchar* p = q.ptr ( i );
      *p += 1; 
  }
      weight.setTo ( 10 );
  </code></pre>
  
  <p>The code compiles without error, but since I don't have any reference to judge the result, I doubt there might be mistakes in my changes. Or am I doing everything right here? Thank you. </p>