title: Take elements that match from a pair of arrays (C++/OpenCV)
body: <p>I'm using an OpenCV function that takes matching elements from two single channel matrices and gives you a resulting array with only that element. The function is called  <a href="http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#compare" rel="nofollow noreferrer"><code>compare</code></a></p>
  <pre><code>cv::compare(maskMat, cv::GC_FGD, result, cv::CMP_EQ);
  </code></pre>
  <p><code>maskMat</code> is my matrix containing any value from <code>0</code>, <code>1</code>, <code>2</code>, or <code>3</code>.</p>
  <p><code>cv::GC_FGD</code> is just a matrix with each element equal to 1.</p>
  <p><code>cv::CMP_EQ</code> is a flag that checks if the two elements are equal.</p>
  <p>What I'd also like to take any values of <code>cv::GC_PR_FGD</code>, which is <code>3</code>. So basically, I wish I do something like <code>(cv::GC_FGD || cv::GC_PR_FGD)</code>, taking any element whose value is <code>1</code> or <code>3</code> for my new resulting matrix.</p>
  <p>Is there a simple way to do this? Thanks</p>