|
|
@ -61,7 +61,7 @@ class App(tk.Frame):
|
|
|
|
#Modify rectangle x1, y1 coordinates
|
|
|
|
#Modify rectangle x1, y1 coordinates
|
|
|
|
self.canvas.coords(self.rectid, self.rectx0, self.recty0,
|
|
|
|
self.canvas.coords(self.rectid, self.rectx0, self.recty0,
|
|
|
|
self.rectx1, self.recty1)
|
|
|
|
self.rectx1, self.recty1)
|
|
|
|
print('Rectangle x1, y1 = ', self.rectx1, self.recty1)
|
|
|
|
#print('Rectangle x1, y1 = ', self.rectx1, self.recty1)
|
|
|
|
|
|
|
|
|
|
|
|
def stopRect(self, event):
|
|
|
|
def stopRect(self, event):
|
|
|
|
#Translate mouse screen x1,y1 coordinates to canvas coordinates
|
|
|
|
#Translate mouse screen x1,y1 coordinates to canvas coordinates
|
|
|
@ -70,7 +70,15 @@ class App(tk.Frame):
|
|
|
|
self.canvas.delete("all")
|
|
|
|
self.canvas.delete("all")
|
|
|
|
self.parent.attributes('-alpha', 0.0)
|
|
|
|
self.parent.attributes('-alpha', 0.0)
|
|
|
|
#Save rect in file png
|
|
|
|
#Save rect in file png
|
|
|
|
rect256 = getRectAsImage((int(self.rectx0), int(self.recty0), int(self.rectx1), int(self.recty1)))
|
|
|
|
|
|
|
|
|
|
|
|
rect256 = getRectAsImage(
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
int(self.rectx0 if self.rectx0 <= self.rectx1 else self.rectx1),
|
|
|
|
|
|
|
|
int(self.recty0 if self.recty0 <= self.recty1 else self.recty1),
|
|
|
|
|
|
|
|
int(self.rectx1 if self.rectx0 <= self.rectx1 else self.rectx0),
|
|
|
|
|
|
|
|
int(self.recty1 if self.recty0 <= self.recty1 else self.recty0)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
rect256.save('screencapture_256_256.png', format='png')
|
|
|
|
rect256.save('screencapture_256_256.png', format='png')
|
|
|
|
self.parent.attributes('-alpha', 0.2)
|
|
|
|
self.parent.attributes('-alpha', 0.2)
|
|
|
|
#Modify rectangle x1, y1 coordinates
|
|
|
|
#Modify rectangle x1, y1 coordinates
|
|
|
@ -82,9 +90,9 @@ class App(tk.Frame):
|
|
|
|
# Get verbose data including boxes, confidences, line and page numbers
|
|
|
|
# Get verbose data including boxes, confidences, line and page numbers
|
|
|
|
print('##Get verbose data including boxes, confidences, line and page numbers##')
|
|
|
|
print('##Get verbose data including boxes, confidences, line and page numbers##')
|
|
|
|
print(pytesseract.image_to_data(Image.open('screencapture_256_256.png'), lang='rus+eng'))
|
|
|
|
print(pytesseract.image_to_data(Image.open('screencapture_256_256.png'), lang='rus+eng'))
|
|
|
|
print('##Get information about orientation and script detection##')
|
|
|
|
|
|
|
|
# Get information about orientation and script detection
|
|
|
|
# Get information about orientation and script detection
|
|
|
|
print(pytesseract.image_to_osd(Image.open('screencapture_256_256.png'), lang='rus+eng'))
|
|
|
|
#print('##Get information about orientation and script detection##')
|
|
|
|
|
|
|
|
#print(pytesseract.image_to_osd(Image.open('screencapture_256_256.png'), lang='rus+eng'))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
root = tk.Tk()
|
|
|
|
root = tk.Tk()
|
|
|
|