title: we are doing pan OCR, using tesseract but is not able to detect the details like name and pan number
body: <p>We are cropping the pan card image by increasing the height by 20px for every iteration and then we are passing that image to tesseract to do ocr but we are getting noise with output.if you have better solution on Image processing or 
  another libraries like cv2 then please help us. </p>
  
  <pre><code>import pytesseract
  from PIL import Image, ImageEnhance, ImageFilter
  
  im = Image.open("image/testpan.jpg")
  width = im.size[0]
  height = im.size[1]
  print('width,height--&gt;',width,height)
  
  yy='img'
  zz='.jpg'
  
  x=0
  for j in range(x,height):
      img2 = im.crop((0, x, width/2,x+70))
      img2.save(yy+str(j)+zz)
  
      img = Image.open(yy+str(j)+zz)
      # img = img.convert("L")
      img.save(yy + str(j) + zz)
      text = pytesseract.image_to_string(Image.open(yy+str(j)+zz))
      print('IIIII',j, text)
  
      x=x+20
      j=x
      if j&gt;height:
          break
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hLtTW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hLtTW.jpg" alt="original image"></a></p>