def initialze(): ImageGene.GeneDictionary = IDEFProcess.extract_training_dictionary() ImageGene.StereoPairs = IDEFProcess.extract_training_stereo_pairs( ImageGene.GeneDictionary) ImageGene.GeneColors = {} max = 0 min = 9999 for k in ImageGene.StereoPairs: lib = ImageGene.analyze_image_blur(ImageGene.imagefile(k, True)) rib = ImageGene.analyze_image_blur(ImageGene.imagefile(k, False)) v = (lib + rib) / 2.0 if v > max: max = v elif v < min: min = v ImageGene.GeneColors[k] = v ctr = 0 for k, v in ImageGene.GeneColors.items(): c1 = int(ctr / 26) c2 = int(ctr % 26) ctr += 1 c1 = chr(ord('a') + c1) c2 = chr(ord('a') + c2) v = ImageGene.GeneColors[k] vn = (v - min) / (max - min) v1 = [int(vn * 255), 0, 0, c1 + c2] ImageGene.GeneColors[k] = v1
def __init__(self): self.left_image_display = None self.right_image_display = None self.training_dictionary = IDEFProcess.extract_training_dictionary() self.stereo_pairs = IDEFProcess.extract_training_stereo_pairs( self.training_dictionary) self.stereo_pair_index = 0 self.blurValue = None self.top = tk.Toplevel() self.top.title("Image Inspector") canvas_frame = tk.Frame(self.top) self.left_image_display = self.create_image_display(canvas_frame) self.right_image_display = self.create_image_display(canvas_frame) canvas_frame.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES) data_frame = tk.Frame(self.top) tk.Button(data_frame, width=10, text="Previous", command=self.previous_image).pack(side=tk.LEFT) self.leftBlurValue = tk.Label(data_frame, text="0.000000") self.leftBlurValue.pack(side=tk.LEFT) self.rightBlurValue = tk.Label(data_frame, text="0.000000") self.rightBlurValue.pack(side=tk.LEFT) tk.Button(data_frame, width=10, text="Delete Pair", command=self.delete_pair).pack(side=tk.LEFT) tk.Button(data_frame, width=10, text="Next", command=self.next_image).pack(side=tk.LEFT) tk.Button(data_frame, width=10, text="Report", command=self.report).pack(side=tk.LEFT) tk.Button(data_frame, width=10, text="Weed", command=self.weed_images).pack(side=tk.LEFT) data_frame.pack(side=tk.TOP)