title: Why so many functions in OPENCV use InputArray and OutputArray as function arguments?
body: <p>Many functions in OPENCV are using InputArray and OutputArray as function arguments. For example, the Hough transform function in OPENCV:</p>
  
  <pre><code>void HoughLines(InputArray image, OutputArray lines, double rho, double theta, int threshold, double srn=0, double stn=0 )
  </code></pre>
  
  <p>Insider the function, we have to use InputArray function <code>getMat</code> to give it to a true input array type. For example, <code>Mat image= _image.getMat()</code>. Similarly, we have to use  <code>copyTo</code> function to transform the true output array to OutputArray format. For example, <code>Mat(lines).copyTo(_lines)</code>. </p>
  
  <p>My question is why OPENCV designs its function signature in this way. Take the hough function for example, if we use the following function signature:</p>
  
  <pre><code>void HoughLines(Mat &amp;image, std::vector&lt;Vec2f&gt; &amp;lines, double rho, double theta, int threshold, double srn=0, double stn=0 )
  </code></pre>
  
  <p>I expect that it would be better as by doing so it will eliminate additional unnecessary copy operations.  </p>