Skip to content

Instantly share code, notes, and snippets.

View rahim42324's full-sized avatar

Rahim Akhtar rahim42324

  • Karachi, Pakistan
View GitHub Profile
#importing modules
import pytesseract
from PIL import Image
print(pytesseract.image_to_data(Image.open('planet.png')))
@rahim42324
rahim42324 / box.py
Last active December 25, 2020 19:27
#importing modules
import pytesseract
from PIL import Image
#bounding box info
print(pytesseract.image_to_boxes(Image.open('planet.png')))
#importing modules
import pytesseract
from PIL import Image
#reading french text from image
print(pytesseract.image_to_string(Image.open('test-european.jpg'), lang='fra'))
#importing opencv and pytesseract
import cv2
import pytesseract
img = cv2.imread("book_page.jpg")
#Resize the image
img = cv2.resize(img, None, fx=0.5, fy=0.5)
#Convert image to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#Convert image to black and white
#importing opencv
import cv2
img = cv2.imread("book_page.jpg")
#Resize the image
img = cv2.resize(img, None, fx=0.5, fy=0.5)
#Convert image to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#Convert image to black and white
adaptive_threshold = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 85, 11)
#importing opencv
import cv2
img = cv2.imread("book_page.jpg")
#Resize the image
img = cv2.resize(img, None, fx=0.5, fy=0.5)
#Convert image to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#Convert image to black and white
adaptive_threshold = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 85, 11)
#importing modules
import pytesseract
from PIL import Image
# If you don't have tesseract executable in your PATH, include the following:
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract'
#converting image to text
print(pytesseract.image_to_string(Image.open('image.png')))
dsad
hello
class university:
def __init__(self,name,department):
self.name=name;
self.department=deparment