title: Can the OpenCV function cvtColor be used to convert a matrix in place?
body: <p>The OpenCV function <a href="http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html#cvtcolor" rel="noreferrer">cvtColor</a> converts the color space of a matrix (e.g. from RGB to grayscale). The function's C++ signature is</p>
  
  <pre><code>void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0 )
  </code></pre>
  
  <p>Can this function be used convert a matrix in place, i.e. with <code>src</code> the same object as <code>dst</code>?</p>
  
  <pre><code>cv::Mat mat = getColorImage();
  cvtColor(mat, mat, CV_RGB2GRAY);
  </code></pre>
  
  <p>(I'm aware that either way, as the destination has a different number of channels than the source, it will still need to allocate a new block of memory for the destination.)</p>
  
  <p>More generally, is there a convention within the OpenCV API to determine when a function may be used in this way?</p>