def extract_without_crop_message(self): extract_choice = QtGui.QMessageBox.question(self,"Continue?","Are you sure you want to continue without cropping the image?",QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) if extract_choice == QtGui.QMessageBox.Yes: print("Proceeding without image crop........") print self.boundary_xy perform_ocr("original_img.jpg") os.startfile("output.txt") else: pass
def extract_message(self): perform_ocr("original_img.jpg") print(self.boundary_xy) msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("Text file saved") msg.setWindowTitle("Information") #msg.setStandardButtons(QMessageBox.Ok) a = QtGui.QPushButton('Ok') a.setStyleSheet( "background-color: orange;border-radius: 15px; border-color: orange;padding-left: 20px;padding-right: 20px;padding-top: 10px;padding-bottom: 10px; border-top: 10px transparent;border-bottom: 10px transparent;border-right: 10px transparent;border-left: 20px transparent;" ) msg.addButton(a, QtGui.QMessageBox.YesRole) msg.setStyleSheet("background-color: rgb(189,189,189);") #msg.buttonClicked.connect(msgbtn) retval = msg.exec_() self.extract_complete_signal.emit()
def extract_text(self): perform_ocr(self.path) # pop-up to show extraction is completed and text file is saved tkinter.messagebox.showinfo('Success', 'Text file saved')
from ocr import perform_ocr perform_ocr(r"F:\Sakshi\Minor\ocr\ocrPython3\test5.jpg") import os os.startfile("output.txt")
#if we don't want to use the UI, then put the filename here. from ocr import perform_ocr perform_ocr(".\image_samples\Test_.jpg") import os import subprocess, sys if sys.platform == "win32": os.startfile("output.txt") print( os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) + "\output.txt") else: opener = "open" if sys.platform == "darwin" else "xdg-open" subprocess.call([opener, "output.txt"]) print( os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) + "\output.txt")
def extract_with_crop(self): print "Extracting with cropped image........" print self.boundary_xy perform_ocr("original_cropped.jpg") os.startfile("output.txt")
#if we don't want to use the UI, then put the filename here. from ocr import perform_ocr perform_ocr("test.jpg") import os os.startfile("output.txt")
#if we don't want to use the UI, then put the filename here. from ocr import perform_ocr perform_ocr("image_samples/Test_.jpg") import os os.startfile("output.txt")
from ocr import perform_ocr perform_ocr(r"F:\Sakshi\Minor\ocr\ocr-master\test1.jpg") import os os.startfile("output.txt")
from ocr import perform_ocr perform_ocr(".\slike\slika4.jpg")