This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ser = serial.Serial( | |
port='COM3', | |
baudrate=38400, | |
parity=serial.PARITY_NONE, | |
stopbits=serial.STOPBITS_ONE, | |
bytesize=serial.EIGHTBITS | |
) | |
ser.close() | |
ser.open() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while 1: | |
a=ser.readline() | |
pos=[] | |
k=0 | |
STR=[] | |
for i in range (0,len(a)): | |
if a[i]==',': | |
pos.append(i) | |
k=k+1 | |
for i in range(1,k): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root=Tk() | |
root.geometry("420x420+400+100") | |
root.title("Where am I? by Bazub") | |
root.bind("<Escape>", lambda e: e.widget.quit()) | |
root.resizable(FALSE,FALSE) | |
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
photo=PhotoImage(file="worldlg.gif") | |
ca=Canvas(root) | |
ca.create_image(200,123,image=photo) | |
ca.grid(row=0,column=0,columnspan=2,sticky=N+S+E+W) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
butGC=Button(root, text="Get coordinates", command=getcoord) | |
butGC.grid(row=1,column=0, sticky=N+S+E+W) | |
var=StringVar() | |
lab =Label(root, bg='white',width=50,height=2,textvariable=var,justify=CENTER) | |
lab.grid(row=1, column=1,sticky=N+S+E) | |
lab2=Label(root) | |
lab2.grid(row=2,column=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
butG2S=Button(root, text="Go to Maps", command=gomaps) | |
butG2S.grid(row=3,column=0,columnspan=2, sticky=N+S+E+W) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def golog(): | |
os.system("notepad.exe "+"C:/Users/Bogdan/git/GPS2PC/GPS2PC/log.txt") | |
butWHIB=Button(root,text="Where have I been?",command=golog) | |
butWHIB.grid(row=5,column=0,columnspan=2,sticky=N+S+E+W) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tesseract | |
from PIL import Image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api = tesseract.TessBaseAPI() | |
api.SetOutputName("outputName"); | |
api.Init(".","eng",tesseract.OEM_DEFAULT) | |
api.SetPageSegMode(tesseract.PSM_AUTO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
im=Image.open("1.jpg") | |
#im=im.rotate(1) | |
im.save("e.jpg") | |
im2=im.convert("L") | |
im2.save("b.jpg") | |
threshold = 100 | |
im = im2.point(lambda p: p > threshold and 255) | |
im.save("d.jpg") | |
img="d.jpg" | |
result = tesseract.ProcessPagesWrapper(img,api) |
OlderNewer