title: C# EmguCV/OpenCV "cvThreshold" abnormal behaviour - no expected threshold result
body: <p>There is a task of recognition red areas on an image and it requires maximum of accuracy. But the quality of a source image is quite bad. I'm trying to minimize a noise on a mask with detected red areas using cvThreshold. Unfortunately, there is no expected effect - gray artifacts stay.  </p>
  
  <pre><code>//Converting from Bgr to Hsv
  Image&lt;Hsv, Byte&gt; hsvimg = markedOrigRecImg.Convert&lt;Hsv, Byte&gt;();
  Image&lt;Gray, Byte&gt;[] channels = hsvimg.Split();
  
  Image&lt;Gray, Byte&gt; hue = channels[0];
  Image&lt;Gray, Byte&gt; saturation = channels[1];
  Image&lt;Gray, Byte&gt; value = channels[2];
  
  Image&lt;Gray, Byte&gt; hueFilter = hue.InRange(new Gray(0), new Gray(30));
  Image&lt;Gray, Byte&gt; satFilter = saturation.InRange(new Gray(100), new Gray(255));
  Image&lt;Gray, Byte&gt; valFilter = value.InRange(new Gray(50), new Gray(255));
  
  //Mask contains gray artifacts        
  Image&lt;Gray,Byte&gt; mask = (hueFilter.And(satFilter)).And(valFilter);
  
  //Gray artifacts stays even if threshold (the third param.) value is 0...
  CvInvoke.cvThreshold(mask, mask, 100, 255, THRESH.CV_THRESH_BINARY);
  
  mask.Save("D:/img.jpg");
  </code></pre>
  
  <p>In the same time here it works fine - saved image is purely white:</p>
  
  <pre><code>#region test
  
  Image&lt;Gray,Byte&gt; some = new Image&lt;Gray, byte&gt;(mask.Size);
  some.SetValue(120);
  CvInvoke.cvThreshold(some, some, 100, 255, THRESH.CV_THRESH_BINARY);
  some.Save("D:/some.jpg");
  
  #endregion
  </code></pre>
  
  <p>Mask before threshold example:
  <a href="http://dl.dropbox.com/u/52502108/input.jpg" rel="nofollow">http://dl.dropbox.com/u/52502108/input.jpg</a></p>
  
  <p>Mask after threshold example:
  <a href="http://dl.dropbox.com/u/52502108/output.jpg" rel="nofollow">http://dl.dropbox.com/u/52502108/output.jpg</a></p>
  
  <p>Thank You in advance.
  Constantine B.</p>