Skip to content

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
TStelzer86 committed Sep 3, 2022
1 parent 3c8a27a commit 014955d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gui/CreateCollages.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def create_collages(LEAF_FOLDER,BG_FOLDER,OUTPUT_FOLDER, N):
key = 'healthy'
if category == 2:
key = 'withered'
overlay_image(bg_image,random_transformation(leaf_images[key][random.randint(0,len(leaf_images)-1)]),mask_image,
overlay_image(bg_image,random_transformation(leaf_images[key][random.randint(0,len(leaf_images[key])-1)]),mask_image,
random.randint(0,bg_image.shape[0]),random.randint(0,bg_image.shape[1]),colors,category)
now = datetime.now()

Expand Down
7 changes: 6 additions & 1 deletion samples/leafs_collage/inspect_leafs_collage_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3.8.10 64-bit",
"language": "python",
"name": "python3"
},
Expand All @@ -951,6 +951,11 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
},
"vscode": {
"interpreter": {
"hash": "91d91624e955430fa00786090cb0be4de8910c7a35e5211665f2dc5c35b06961"
}
}
},
"nbformat": 4,
Expand Down
11 changes: 7 additions & 4 deletions tkgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,17 @@ def __init__(self, parent):
label = ttk.Label(self, text="Inspector: This is the leaf tinder page")
#label.pack(side="top", fill="x", pady=label_pad)
label.grid(row =0, column=1)
self.canvas = tk.Canvas(self, width = main_canvas_width-100, height = main_canvas_height-100, bg = 'gray')
self.canvas_width = main_canvas_width-100
self.canvas_height = main_canvas_height-100
self.canvas = tk.Canvas(self, width = self.canvas_width, height = self.canvas_height, bg = 'gray')
#self.canvas.pack()
self.canvas.grid(row =1, column=1)
self.img_filename = "gui/leaf.png"
self.image = Image.open(self.img_filename)
self.maxsize = main_canvas_height - 100
self.image = resize_image_height(self.image,self.maxsize)
self.img = ImageTk.PhotoImage(self.image)
self.image_container = self.canvas.create_image((main_canvas_width-100-self.image.size[0])/2,(main_canvas_height-100-self.image.size[1])/2, anchor=tk.NW,image=self.img)
self.image_container = self.canvas.create_image((self.canvas_width)/2,(self.canvas_height)/2, anchor=tk.CENTER,image=self.img)
self.startButton = ttk.Button(self, text = "Start", command = lambda: self.start_tinder())
self.startButton.grid(row=2, column = 0)
self.lbl_descr = ttk.Label(self,text = "Leaf category: ")
Expand Down Expand Up @@ -208,8 +210,8 @@ def show_next_image(self):
#image.thumbnail(maxsize, Image.ANTIALIAS)
#image = resize_image_height(image,self.maxsize)
self.img = ImageTk.PhotoImage(self.image)
self.canvas.itemconfig(self.image_container,image=self.img,anchor=tk.NW)
self.canvas.coords(self.image_container,(main_canvas_width-200-self.image.size[0])/2,(main_canvas_height-200-self.image.size[1])/2)
self.canvas.itemconfig(self.image_container,image=self.img,anchor=tk.CENTER)
self.canvas.coords(self.image_container,(self.canvas_width)/2,(self.canvas_height)/2)
return

def start_tinder(self):
Expand Down Expand Up @@ -263,6 +265,7 @@ def load_leafs(self,folder):
img = cv2.imread(os.path.join(folder,a['filename']),flags=cv2.IMREAD_ANYCOLOR)
if img is None:
print("img is NoneType")
continue
height, width, channels = img.shape
#print(os.path.join(LEAF_FOLDER,image))
#print(leaf_image.shape)
Expand Down

0 comments on commit 014955d

Please sign in to comment.