diff --git a/.pylintrc b/.pylintrc
new file mode 100644
index 0000000..9b6b176
Binary files /dev/null and b/.pylintrc differ
diff --git a/requirements.txt b/requirements.txt
index 8601087..f92b3d8 100644
Binary files a/requirements.txt and b/requirements.txt differ
diff --git a/src/config/config.template.json b/src/config/config.template.json
index a17404f..21299f1 100644
--- a/src/config/config.template.json
+++ b/src/config/config.template.json
@@ -1,5 +1,8 @@
{
"path": "",
- "out": "",
- "size": 750
+ "out": {
+ "img": "",
+ "log": ""
+ },
+ "size": 100
}
\ No newline at end of file
diff --git a/src/helpers/canvas.py b/src/helpers/canvas.py
new file mode 100644
index 0000000..1c69420
--- /dev/null
+++ b/src/helpers/canvas.py
@@ -0,0 +1,103 @@
+import cv2
+import tkinter
+from PIL import ImageTk, Image
+import datetime
+import pathlib
+import os
+
+from helpers.logger import C_INFO, C_DONE, C_ERR
+
+class CVSuiteCanvas:
+ def __init__(self, canvas):
+ self.canvas = canvas
+
+ self.name = "" # Name of current image
+ self.imgs = [] # OpenCV Image data
+ self.tk_imgs = [] # Tkinter Image data
+ self.tags = [] # Tag data
+
+ def add(self, data, name: str):
+ """
+ Add CV2 image to canvas output
+ """
+ self.imgs.append(data)
+ self.tags.append(name)
+
+ def clear(self):
+ """
+ Clear canvas
+ """
+ self.imgs = []
+ self.tags = []
+
+ def draw(self, size):
+ """
+ Update canvas
+ """
+ # Check if size of canvas has updated
+ drawW = self.canvas.winfo_width()
+
+ # Reset drawing position
+ drawX = 0
+ drawY = 0
+
+ # Clear previously printed images
+ self.tk_imgs = []
+
+ # self.meta.config(state=tkinter.NORMAL)
+ # self.meta.delete(1.0, tkinter.END)
+ # self.meta.insert(tkinter.END, f"{self.img_name}\n")
+
+ # Draw all output images
+ for idx, data in enumerate(self.imgs):
+ # Create ui image
+ tk_img = cv2.cvtColor(data, cv2.COLOR_BGR2RGB)
+ tk_img = ImageTk.PhotoImage(image=Image.fromarray(tk_img))
+ self.tk_imgs.append(tk_img)
+
+ ## Check if next item will be out of range
+ if drawX + size >= drawW:
+ drawY += size
+ drawX = 0
+ self.canvas.configure(height=(drawY + size))
+
+ self.canvas.create_image(
+ drawX, drawY, anchor=tkinter.NW, image=self.tk_imgs[idx], tags="og"
+ )
+
+ # Add name to text box
+ tag = self.canvas.create_text(drawX+5, drawY+5, anchor=tkinter.NW, text=F"{idx} {self.tags[idx]}", fill="black", font=('Helvetica 12 bold'))
+ tag_bg = self.canvas.create_rectangle(self.canvas.bbox(tag), fill="white")
+ self.canvas.tag_lower(tag_bg,tag)
+ # self.meta.insert(tkinter.END, f"{idx}: {self.output[1][idx]}\n")
+
+ drawX += size
+
+ # Clear output
+ # self.meta.config(state=tkinter.DISABLED)
+
+ def export(self, id, name, path):
+ """
+ Export id to file
+ """
+ # Get export settings
+ img_arr = self.tk_imgs
+
+ print(C_INFO, f"Using path: {path}")
+
+ if id >= 0 and id < len(img_arr):
+ # Create file
+ now = datetime.datetime.now()
+ new_file_name = f"{name}-{self.tags[id]}-{now.strftime('%Y-%m-%dT%H.%M.%S')}.png"
+
+ # Put data
+ file_path = pathlib.Path(path, new_file_name)
+ # print(file_path)
+
+ img_pil = ImageTk.getimage(self.tk_imgs[id])
+ img_pil.save(file_path, "PNG")
+ img_pil.close()
+
+ print(C_DONE, f"Exported Image ID {id} ({self.tags[id]}) to {os.path.join(path, new_file_name)}")
+ else:
+ print(C_ERR, "Nothing to export!")
\ No newline at end of file
diff --git a/src/helpers/gui/main.ui b/src/helpers/gui/main.ui
index abd321f..0f899d7 100644
--- a/src/helpers/gui/main.ui
+++ b/src/helpers/gui/main.ui
@@ -194,8 +194,8 @@
-
-
-