def Main(imgPath, cached=True): imgRGB = cv2.imread(imgPath) subImgs = roughdetect.RoughDetect(imgRGB) sess = tf.Session() pred = predict.Predict(sess, '.\\model') res = [] for subImg in subImgs: if cached: cache.Cache(subImg) rectL = crop.Crop(subImg, crop.condition1, crop.thres1) subImgDeskewH = deskewH.DeskewH(subImg, rectL) imgRes = deskewV.DeskewV(subImgDeskewH) res.append(pred.predict(imgRes)) sess.close() return max(res)
def restart_crop(self, id): time.sleep(0.1) try: crop_obj = crop.Crop() except KeyboardInterrupt: os.killpg(0, signal.SIGINT) sys.exit(1) except Exception as e: LOG.error('Failed to init Crop: {}'.format(e)) self.restart_crop(id) return crop_process = Process(target=crop_obj.crop_task, args=( self, id, )) crop_process.start()
def get_file(self, root): self.fname = filedialog.askopenfilename(title=u"choose the file") tk.Label(root, text='path : {}'.format(self.fname), height=2).grid(row=0, column=1, columnspan=2, padx=10, pady=10) cp = crop.Crop(self.fname) cp.get_screenshot()
def add(self, root, instance): cp = crop.Crop(self.fname) self.pos_dict[instance] = cp.get_position() self.show_list(root)
def main(): new_crop = crop.Crop(2,7,3) manage_crop(new_crop) print(new_crop.report())