From 5b1b25bc13c8ee78c0102aba5b2f02eccad848cf Mon Sep 17 00:00:00 2001 From: Arne van Iterson Date: Sat, 23 Sep 2023 18:35:51 +0200 Subject: [PATCH 1/2] Moved some shit around --- .gitignore | 59 +++++++++++++++++- md/nuts.md | 18 ------ {src => old}/adj.py | 0 src/config/config.template.json | 4 ++ .../algorithms/canny_map.py | 0 .../algorithms/colourspace.py | 0 .../algorithms/image/test.jpg | Bin .../algorithms/orb.py | 0 .../algorithms/sift.py | 0 .../algorithms/sift_v2.py | 0 .../algorithms/sift_v3.py | 0 src/{ => experiments/algorithms}/tree_edge.py | 0 .../input/callibratie_recht.jpg | Bin .../input/callibratie_scheef.jpg | Bin .../template_extraction/input/scheef.jpg | Bin .../template_extraction/input/template.jpg | Bin .../template_extraction/input/wood.jpg | Bin .../template_extraction/script.py | 0 md/notes.md => src/helpers/algorithms.py | 0 .../__pycache__/pysift.cpython-311.pyc | Bin 28460 -> 0 bytes src/{ => helpers}/gui/main.ui | 0 src/suite.py | 5 +- 22 files changed, 65 insertions(+), 21 deletions(-) delete mode 100644 md/nuts.md rename {src => old}/adj.py (100%) create mode 100644 src/config/config.template.json rename src/{helpers => experiments}/algorithms/canny_map.py (100%) rename src/{helpers => experiments}/algorithms/colourspace.py (100%) rename src/{helpers => experiments}/algorithms/image/test.jpg (100%) rename src/{helpers => experiments}/algorithms/orb.py (100%) rename src/{helpers => experiments}/algorithms/sift.py (100%) rename src/{helpers => experiments}/algorithms/sift_v2.py (100%) rename src/{helpers => experiments}/algorithms/sift_v3.py (100%) rename src/{ => experiments/algorithms}/tree_edge.py (100%) rename src/{helpers => experiments}/template_extraction/input/callibratie_recht.jpg (100%) rename src/{helpers => experiments}/template_extraction/input/callibratie_scheef.jpg (100%) rename src/{helpers => experiments}/template_extraction/input/scheef.jpg (100%) rename src/{helpers => experiments}/template_extraction/input/template.jpg (100%) rename src/{helpers => experiments}/template_extraction/input/wood.jpg (100%) rename src/{helpers => experiments}/template_extraction/script.py (100%) rename md/notes.md => src/helpers/algorithms.py (100%) delete mode 100644 src/helpers/algorithms/__pycache__/pysift.cpython-311.pyc rename src/{ => helpers}/gui/main.ui (100%) diff --git a/.gitignore b/.gitignore index 1fcb152..e29639e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,58 @@ -out +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +bin/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +out/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Rope +.ropeproject + +# Django stuff: +*.log +*.pot + +# Sphinx documentation +docs/_build/ + +# Temp +.venv/ +.vscode/ + +# Config file +src/config/config.json \ No newline at end of file diff --git a/md/nuts.md b/md/nuts.md deleted file mode 100644 index 229a75b..0000000 --- a/md/nuts.md +++ /dev/null @@ -1,18 +0,0 @@ -### Jullie gaan noten herkennen - -Hoe de neuk? Nut. -1. Hoe gaan we de noten herkennen (beeld, smaak, geluid, text)? - - Beeldherkenning lol -2. Wat zijn de visuele kenmerken van de noten? - - Vorm, kleur, textuur, grootte -3. Hoeveel noten willen we herkennen - - Qua type, hoeveel verschillende noten - - Qua tijd, hoeveel noten tegelijkertijd -4. Wat is de achtergrond -5. Met wat voor camera worden de noten bekeken -6. Is de noot verwerkt - -De deelvragen moeten sequentieel zijn - - -Wij moeten presenteren volgende week diff --git a/src/adj.py b/old/adj.py similarity index 100% rename from src/adj.py rename to old/adj.py diff --git a/src/config/config.template.json b/src/config/config.template.json new file mode 100644 index 0000000..7594d9d --- /dev/null +++ b/src/config/config.template.json @@ -0,0 +1,4 @@ +{ + "path": "", + "size": 750 +} \ No newline at end of file diff --git a/src/helpers/algorithms/canny_map.py b/src/experiments/algorithms/canny_map.py similarity index 100% rename from src/helpers/algorithms/canny_map.py rename to src/experiments/algorithms/canny_map.py diff --git a/src/helpers/algorithms/colourspace.py b/src/experiments/algorithms/colourspace.py similarity index 100% rename from src/helpers/algorithms/colourspace.py rename to src/experiments/algorithms/colourspace.py diff --git a/src/helpers/algorithms/image/test.jpg b/src/experiments/algorithms/image/test.jpg similarity index 100% rename from src/helpers/algorithms/image/test.jpg rename to src/experiments/algorithms/image/test.jpg diff --git a/src/helpers/algorithms/orb.py b/src/experiments/algorithms/orb.py similarity index 100% rename from src/helpers/algorithms/orb.py rename to src/experiments/algorithms/orb.py diff --git a/src/helpers/algorithms/sift.py b/src/experiments/algorithms/sift.py similarity index 100% rename from src/helpers/algorithms/sift.py rename to src/experiments/algorithms/sift.py diff --git a/src/helpers/algorithms/sift_v2.py b/src/experiments/algorithms/sift_v2.py similarity index 100% rename from src/helpers/algorithms/sift_v2.py rename to src/experiments/algorithms/sift_v2.py diff --git a/src/helpers/algorithms/sift_v3.py b/src/experiments/algorithms/sift_v3.py similarity index 100% rename from src/helpers/algorithms/sift_v3.py rename to src/experiments/algorithms/sift_v3.py diff --git a/src/tree_edge.py b/src/experiments/algorithms/tree_edge.py similarity index 100% rename from src/tree_edge.py rename to src/experiments/algorithms/tree_edge.py diff --git a/src/helpers/template_extraction/input/callibratie_recht.jpg b/src/experiments/template_extraction/input/callibratie_recht.jpg similarity index 100% rename from src/helpers/template_extraction/input/callibratie_recht.jpg rename to src/experiments/template_extraction/input/callibratie_recht.jpg diff --git a/src/helpers/template_extraction/input/callibratie_scheef.jpg b/src/experiments/template_extraction/input/callibratie_scheef.jpg similarity index 100% rename from src/helpers/template_extraction/input/callibratie_scheef.jpg rename to src/experiments/template_extraction/input/callibratie_scheef.jpg diff --git a/src/helpers/template_extraction/input/scheef.jpg b/src/experiments/template_extraction/input/scheef.jpg similarity index 100% rename from src/helpers/template_extraction/input/scheef.jpg rename to src/experiments/template_extraction/input/scheef.jpg diff --git a/src/helpers/template_extraction/input/template.jpg b/src/experiments/template_extraction/input/template.jpg similarity index 100% rename from src/helpers/template_extraction/input/template.jpg rename to src/experiments/template_extraction/input/template.jpg diff --git a/src/helpers/template_extraction/input/wood.jpg b/src/experiments/template_extraction/input/wood.jpg similarity index 100% rename from src/helpers/template_extraction/input/wood.jpg rename to src/experiments/template_extraction/input/wood.jpg diff --git a/src/helpers/template_extraction/script.py b/src/experiments/template_extraction/script.py similarity index 100% rename from src/helpers/template_extraction/script.py rename to src/experiments/template_extraction/script.py diff --git a/md/notes.md b/src/helpers/algorithms.py similarity index 100% rename from md/notes.md rename to src/helpers/algorithms.py diff --git a/src/helpers/algorithms/__pycache__/pysift.cpython-311.pyc b/src/helpers/algorithms/__pycache__/pysift.cpython-311.pyc deleted file mode 100644 index 44f6a7568ff44ee6562b710a64eae89b4639b02c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28460 zcmeHwdvIIXc^?1*1W17I_Zy^0iQxMwi4-L+Nr{put|;m)N?I;NfFvY>q%J@`xEET* zwI_@#C)|u3W7FLhPS;x~yPI&Q>y+!%2|W|HN@g;159hiUf?&7a8k7EBa)3nvP_MH5Bd;)!B!$wY~_ zbfQ#G`5ETQyyX++-inC|Z{ zdiPE2<7U%b{Y1S%=dQo$h*!$p@HT4m4t~lr(dbH@XmZuMtY6hnG`nnH)lIaxGC*5h znV@a1EYNmWHfV>d&XtQ$ovu9Cx?Fo*1+aCy3SrytDgr&=+UF{R+d)@3Y(1_D&|X(1 z=pk1XXrHUzwFmx(U8Zw7hvO3}f}=E=;+&fUnZF-3IR(LaKWcUgQ-0@sM>J(>!52;O zdFG=j?t6>T6xV`3nliUA6SabPrkrz=&UshVC@dfWqwluhkD7db=hUsJ$uBsk+|i7s zdBJ(dJvZr@ce(FH4U3+r+2x+;5S*^48KeW2sOj#kTX08B%WeU=nWpC!7KEsAdWi}( z@0^dCJU;#s7M75i8U9XxXNMyN#c?CUIiKHmJ8GO?5WJ4mXsY1$d6wN#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?ig7p+JxzHQ7|c1Zhg7#Z#@c W=Ge=r{Vd8y$^QZL(8$pM diff --git a/src/gui/main.ui b/src/helpers/gui/main.ui similarity index 100% rename from src/gui/main.ui rename to src/helpers/gui/main.ui diff --git a/src/suite.py b/src/suite.py index a384aa3..4359ba9 100644 --- a/src/suite.py +++ b/src/suite.py @@ -10,7 +10,8 @@ import time import matplotlib.pyplot as plt PROJECT_PATH = pathlib.Path(__file__).parent -PROJECT_UI = "./src/gui/main.ui" +PROJECT_UI = "./src/helpers/gui/main.ui" +CONFIG_PATH = "./src/config/config.json" class MainApp: def __init__(self, master=None): @@ -36,7 +37,7 @@ class MainApp: # UI self.blur_rate = None - self.img_size = None + self.img_size = 100 self.sobel_select = None self.export_id = None builder.import_variables(self, From 3ae6b41c62558a797e1a51be29de10a474c62b92 Mon Sep 17 00:00:00 2001 From: Arne van Iterson Date: Sat, 23 Sep 2023 21:02:30 +0200 Subject: [PATCH 2/2] Suite QOL --- {old => src/experiments}/adj.py | 0 src/helpers/gui/main.ui | 31 ++++-- src/suite.py | 172 +++++++++++++++++++++----------- 3 files changed, 135 insertions(+), 68 deletions(-) rename {old => src/experiments}/adj.py (100%) diff --git a/old/adj.py b/src/experiments/adj.py similarity index 100% rename from old/adj.py rename to src/experiments/adj.py diff --git a/src/helpers/gui/main.ui b/src/helpers/gui/main.ui index 75d724a..05cdc74 100644 --- a/src/helpers/gui/main.ui +++ b/src/helpers/gui/main.ui @@ -5,6 +5,7 @@ 800 Tree Recogniser 7000 200 + false @@ -175,9 +176,9 @@ - - Next img - + + Prev img + 1 10 @@ -186,9 +187,9 @@ - - Prev img - + + Next img + 2 10 @@ -213,7 +214,7 @@ 2 - 2 + 1 0 6 @@ -238,6 +239,22 @@ + + + 10 + 0 + disabled + Image metadata should appear here + 25 + word + + 3 + 1 + 0 + 8 + + + diff --git a/src/suite.py b/src/suite.py index 4359ba9..2242a05 100644 --- a/src/suite.py +++ b/src/suite.py @@ -8,11 +8,18 @@ import numpy as np import cv2 import time import matplotlib.pyplot as plt +import json +## UI config load PROJECT_PATH = pathlib.Path(__file__).parent PROJECT_UI = "./src/helpers/gui/main.ui" -CONFIG_PATH = "./src/config/config.json" +## Config file load +CONFIG_PATH = "./src/config/config.json" +config_file = open(CONFIG_PATH) +config_json = json.load(config_file) + +## UI class setup class MainApp: def __init__(self, master=None): self.builder = builder = pygubu.Builder() @@ -22,38 +29,51 @@ class MainApp: # Main widget self.mainwindow = builder.get_object("main", master) + # Canvas for output images self.canvas = builder.get_object("output_canvas") - self.tk_imgs = [] - - self.canny_thr1 = None - self.canny_thr2 = None - - self.img_path = None + self.tk_imgs = [] # Required or python will forget + self.output = [[] for x in range(2)] + self.meta = builder.get_object("dataset") + + # Keep track of images in dataset self.img_current = 0 self.img_max = 0 # Plots self.axs = self.createPlot(2, 2) - # UI + # UI Variables + self.canny_thr1 = None + self.canny_thr2 = None + self.img_path = None self.blur_rate = None - self.img_size = 100 + self.img_size = None self.sobel_select = None self.export_id = None - builder.import_variables(self, - ['canny_thr1', - 'canny_thr2', - 'img_path', - 'blur_rate', - 'img_size', - 'sobel_select', - 'export_id']) + builder.import_variables(self, ['canny_thr1','canny_thr2','img_path','blur_rate','img_size', 'sobel_select', 'export_id']) builder.connect_callbacks(self) + + # Load values from config after UI has been initialised + self.img_path.set(config_json["path"]) + self.img_size.set(config_json["size"]) + + def on_quit(self, event=None): + ''' + Close PLT windows on main app quit + ''' + plt.close() + self.mainwindow.quit(); def run(self): + ''' + Run loop + ''' self.mainwindow.mainloop() def img_prev(self, event=None): + ''' + Open previous image from path + ''' if self.img_current == 0: self.img_current = self.img_max - 1 else: @@ -61,6 +81,9 @@ class MainApp: self.update(self) def img_next(self, event=None): + ''' + Open next image from path + ''' if self.img_current == (self.img_max - 1): self.img_current = 0 else: @@ -68,6 +91,9 @@ class MainApp: self.update(self) def apply(self, event=None): + ''' + Export current dataset + ''' img_arr = self.tk_imgs img_id = self.export_id.get() @@ -76,10 +102,58 @@ class MainApp: else: print("Nothing to export!") + def add_output(self, data, name: str): + ''' + Add CV2 image to canvas output + ''' + self.output[0].append(data) + self.output[1].append(name) + + def draw_output(self, size): + # 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=NORMAL) + self.meta.delete(1.0, END) + + # Draw all output images + for idx, data in enumerate(self.output[0]): + # 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=NW,image=self.tk_imgs[idx],tags="og") + drawX += size + + # Add name to text box + self.meta.insert(END, F"{idx}: {self.output[1][idx]}\n") + + # Clear output + self.output = [[] for x in range(2)] + self.meta.config(state=DISABLED) + + # Draw canvas + # TODO IDK volgens mij moet je deze wel callen maar het programma doet het nog (geen vragen stellen) + # self.canvas.draw() + def createPlot(self, columns, rows): fig, axs = plt.subplots(columns, rows) return axs - + def drawHist(self, image, labels, column, row): self.axs[column, row].clear() for i,lab in enumerate(labels): @@ -121,11 +195,6 @@ class MainApp: def update(self, event=None): path = self.img_path.get() - print(path) - - drawW = self.canvas.winfo_width() - drawX = 0 - drawY = 0 if path != None and path != "": # Get all images at current path @@ -142,31 +211,24 @@ class MainApp: sxy = self.sobel_select.get() size = self.img_size.get() - # Keep array of cv2 images to output - output = [] - - # Clear previously printed images - self.tk_imgs = [] - # Import and resize image img = cv2.imread(images[self.img_current]) img = cv2.resize(img, (size, size), interpolation = cv2.INTER_AREA) - output.append(img) # First output image is original + self.add_output(img, "Original") # Set grayscale img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) - output.append(img_gray) # Second output is grayscale + self.add_output(img_gray, "Grayscale") # Blurred edition if (br == 0): - # Disable img_blur = img_gray elif (br % 2 == 1): img_blur = cv2.GaussianBlur(img_gray, (br, br), 0) else: print(f"Blur rate changed to {br - 1}") img_blur = cv2.GaussianBlur(img_gray, (br-1, br-1), 0) - output.append(img_blur) + self.add_output(img_blur, "Blurred") # Sobel edge if sxy in ['x', 'y', 'both']: @@ -182,49 +244,37 @@ class MainApp: img_sobel = cv2.Sobel(src=img_blur, ddepth=cv2.CV_8U, dx=dx, dy=dy, ksize=5) else: - img_sobel = img_gray - output.append(img_sobel) + img_sobel = img_gray + self.add_output(img_sobel, "Sobel Edge") # Canny edge img_canny = cv2.Canny(image=img_blur,threshold1=ct1,threshold2=ct2) - output.append(img_canny) + self.add_output(img_canny, "Canny Edge") # BGR - output.append(img[:, :, 0]) # B - output.append(img[:, :, 1]) # G - output.append(img[:, :, 2]) # R + self.add_output(img[:, :, 0], "BGR B") + self.add_output(img[:, :, 1], "BGR G") + self.add_output(img[:, :, 2], "BGR R") + if img is not None: self.drawHist(img, ('B', 'G', 'R'), 0, 0) # HSV img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) - output.append(img_hsv) - output.append(img_hsv[:, :, 0]) # H - output.append(img_hsv[:, :, 1]) # S - output.append(img_hsv[:, :, 2]) # V + self.add_output(img_hsv, "HSV") + self.add_output(img_hsv[:, :, 0], "HSV H") # H + self.add_output(img_hsv[:, :, 1], "HSV S") # S + self.add_output(img_hsv[:, :, 2], "HSV V") # V + if img_hsv is not None: self.drawHist(img_hsv, ('H', 'S', 'V'), 0, 1) + # Canny Heatmap self.drawCannyHM(img, 1, 1) - - plt.show(block=False) - # Draw all output images - for idx, data in enumerate(output): - # 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=NW,image=self.tk_imgs[idx],tags="og") - drawX += size - self.canvas.draw() + # Show all data + plt.show(block=False) ## Graphs + self.draw_output(size) ## Images if __name__ == "__main__": app = MainApp()