def __init__(self): self.imPro = ImageProcess() self.km = KeyAndMouse() self.boolStart = 0 self.root = Tk() self.root.title('剑灵取色卡刀') self.lable_Welcome = Label( self.root, text='这是剑灵的取色卡刀软件,使用详情请阅读 README.txt文件').grid(row=3, columnspan=7, padx=10, pady=10, ipadx=5, ipady=5) self.lable_LB = Label(self.root, text='LB').grid(row=5, column=0, padx=10, pady=10, ipadx=5, ipady=5) self.lable_RB = Label(self.root, text='RB').grid(row=6, column=0, padx=10, pady=10, ipadx=5, ipady=5) self.lable_F = Label(self.root, text='F').grid(row=7, column=0, padx=10, pady=10, ipadx=5, ipady=5) self.lable_4 = Label(self.root, text='4').grid(row=8, column=0, padx=10, pady=10, ipadx=5, ipady=5) self.lable_V = Label(self.root, text='v').grid(row=9, column=0, padx=10, pady=10, ipadx=5, ipady=5) self.ButtonItem('捕捉图片', 5, 1, self.LB_cal) self.ButtonItem('捕捉图片', 6, 1, self.RB_cal) self.ButtonItem('捕捉图片', 7, 1, self.F_cal) self.ButtonItem('捕捉图片', 8, 1, self.K_4_cal) self.ButtonItem('捕捉图片', 9, 1, self.V_cal) self.ButtonItem('初始化', 10, 0, self.Init_cal, 1, 2) self.ButtonItem('开始', 10, 3, self.Start_cal, 1, 2) self.ButtonItem('暂停', 10, 6, self.Pause_cal, 1, 2)
# Imports from Driver import Driver, Direction import ImageProcess import pygame import picamera import tty import sys import NeuralNetworkThree # Initializing variables continue=True stream=io.BytesIO() #where we store the pictures processer = ImageProcess.ImageProcess() driver = Driver() cam = picamera.PiCamera() cam.hflip = True cam.vflip=True cam.resolution = (1280, 720) cam.framerate=80 print("Auto mode started") # Loop me til you kill me while continue: # take a picture cam.capture(stream,use_video_port=True) # Read In Photo try: stream.seek(0)
from ImageProcess import getImages import ImageProcess processer = ImageProcess.ImageProcess() # create the image processing object def imageProcesser(images): #returns a list of processed images in ARRAY FORM for item in images: processer.imageProcesser(item) print(item + " was the " + str(len( processer.pictures))) # helps visualize what my code is doing # the greyscale function is MUUUUCH slower than the longer ImageProcesser function return processer.pictures # as it has to check each pixel indivudaly, then average the R+G+B values of non red #pixels to manually convert each pixel to greyscale images = getImages( ) # commenting out this line will cause the program to not process old or new images convertedImages = imageProcesser( images) #returns a list of processed IMAGES IN ARRAY FORM print( convertedImages ) # shows this list of image arrays, *NOTE* FOR SOME REASON THE IMAGES PROCESSED BY GREYSCALE LOOK # slightly different than the images processed by image processor, all the images look the #when they are saved. so idk have to test with quinton's code to see if I need to convert # all the images the same way