title: How to find only the bolded text lines from no. of images
body: <pre><code>from PIL import Image
  import pytesseract
  from pdf2image import convert_from_path
  import os
  import pandas as pd
  import cv2
  import numpy as np
  
  files = os.chdir("C:/Users/abhishek_kumar1/Desktop/New folder")
  #print(os.getcwd())
  pages = convert_from_path("d.pdf",190,single_file=True,
                        poppler_path='C:/Users/abhishek_kumar1/Downloads/poppler-0.68.0_x86/poppler-0.68.0/bin')
  image_counter=1
  for page in pages:
      filename = "page_"+str(image_counter)+".jpg"
      page.save(filename,'JPEG')
  
  img = cv2.imread(filename)
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  cv2.imwrite('grey.png',gray)
  binary,thresh1 = cv2.threshold(gray, 0, 255,cv2.THRESH_OTSU|cv2.THRESH_BINARY_INV)
  cv2.imwrite('Thresh1.png',thresh1)
  rect_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (15, 3))
  dilation = cv2.dilate(thresh1, rect_kernel, iterations = 6)
  contours, hierarchy = cv2.findContours(dilation, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
  im2 = img.copy()
  
  
  ROI_number = 0
  for cnt in contours[::-1]:
      [x,y,w,h] = cv2.boundingRect(cnt)
      ROI=im2[y:y+h, x:x+w]
      #print(str(w),str(h))
      #cv2.putText(im2, str(h), (x,y - 10 ), cv2.FONT_HERSHEY_SIMPLEX, 0.1, (255, 0, 0), 1)
      #cv2.putText(im2, str(w), (x,y + 10 ), cv2.FONT_HERSHEY_SIMPLEX, 0.1, (0, 0, 255), 1)
      cv2.imwrite('ROI_{}.jpg'.format(ROI_number),ROI)
      cv2.rectangle(im2,(x,y),(x+w,y+h),(36,255,12),1)
      ROI_number += 1
  
  cv2.imwrite('contours1.png',im2)
  </code></pre>
  
  <p>How to find only this image from above code section section, is there any options to understand font type from image like bold, italic,something else
  get trouble to find only the bold line part from all of images.
  Please any body have a suggestion regarding this please help me out.</p>