title: OpenCV convert all negative values to zero
body: <p>I would like to implement a function that takes a <code>cv::Mat</code> and sets all negative values to zero. The most direct operation to do this appears to be the <code>threshold</code> function documented <a href="https://docs.opencv.org/2.4/modules/imgproc/doc/miscellaneous_transformations.html#threshold" rel="nofollow noreferrer">here</a> so that the function <code>pos(x)</code></p>
  
  <pre><code>void pos(cv::Mat x, cv::Mat result)
  {           
      cv::threshold(x, result, 0, 0, CV_THRESH_TOZERO);
      return;
  }
  </code></pre>
  
  <p>Is this the most appropriate way to set all negative values to zero or is there a faster or more direct way?</p>