title: Equivalent of Matlabs "Find" function in opencv
body: <p>I am trying to convert a matlab code to Opencv Code.<br>
   I need to convert the below code to opencv.<br>
  <strong>I would like to know is there any equivalent of matlab find function in opencv.</strong></p>
  
  <p>S has <code>(x,y)</code> data and size of S is <code>100x2</code></p>
  
  <pre><code>ind = find(S(:,1) &gt;= xm &amp; S(:,1) &lt;= xM &amp; S(:,2) &gt;= ym &amp; Sm(:,2) &lt;= yM);
  Snew = S(ind,:);
  </code></pre>
  
  <p><strong>Edit:</strong>
  In the question <a href="https://stackoverflow.com/questions/10597107/opencv-function-similar-to-matlabs-find">OpenCV function similar to matlab's “find”</a>, the output Snew and the input S are of same size, but here in my question, Snew is not of the same size as S.. For example:</p>
  
  <pre><code>S = [ 76    96
      26    55
      51    14
      70    15
      90    26]
  
  ind = find(S(:,1) &gt; 50);
  Snew = S(ind3,:);
  
  Snew = [ 76    96
      51    14
      70    15
      90    26]
  </code></pre>
  
  <p>As you can see, Snew and S are not of same size...</p>
  
  <p>The im in the refered question is of the same size of initial input im...</p>