title: Emgcucv: Gray scale to threshold image not working for OCR
body: <p>Ok, I agree  I am noob in image processing and OCR. I am having color Pan card which i have to pass to tesseract OCR. I found following thread  [here].</p>
  
  <p>(<a href="https://stackoverflow.com/questions/47709192/we-are-doing-pan-ocr-using-tesseract-but-is-not-able-to-detect-the-details-like">we are doing pan OCR, using tesseract but is not able to detect the details like name and pan number</a>). I have understood that I may have to perform following steps.</p>
  
  <ul>
  <li>convert to gray</li>
  <li>threshold</li>
  <li>findContours</li>
  <li>boundingRect</li>
  </ul>
  
  <p>when I am  converting my colored image to gray scale and gray scale image to threshold, my gray scale image getting turn into complete black. 
  I played around with parameter but not getting any positive result. 
    So can someone help me on it?</p>
  
  <p>Another thing I want to know whether it is required to convert colored image to gray scale then to threshold for OCR? Or i can directly convert color image to threshold? </p>
  
  <p>I forgot to mentioned that I am using emguCV, Tesseract and Csharp.</p>
  
  <p><a href="https://i.stack.imgur.com/sgP4y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sgP4y.jpg" alt="Please check image here."></a></p>
  
  <p>I have posted  image above and code below.</p>
  
  <pre><code>Image&lt;Bgr, byte&gt; imgInput; = new Image&lt;Bgr, byte&gt;(impath);
   Image&lt;Gray, Byte&gt; img2 = imgInput.Convert&lt;Gray, Byte&gt;(); 
  Image&lt;Gray, byte&gt; imgout = imgInput.Convert&lt;Gray, byte&gt;().Not().ThresholdBinary(new Gray(50), new Gray(125));
  VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint(); 
  var blurredImage = imgout.SmoothGaussian(5, 5, 0, 0); 
  
  CvInvoke.AdaptiveThreshold(imgout, imgout, 255, Emgu.CV.CvEnum.AdaptiveThresholdType.GaussianC, Emgu.CV.CvEnum.ThresholdType.Binary, 5, 45);
  
  </code></pre>
  
  <p>Any help will be highly appreciated.</p>