diff --git a/src/helpers/gui/main.ui b/src/helpers/gui/main.ui index 4594100..abd321f 100644 --- a/src/helpers/gui/main.ui +++ b/src/helpers/gui/main.ui @@ -1,7 +1,7 @@ - 800x600 + 1024x768 800 Tree Recogniser 7000 200 @@ -231,7 +231,7 @@ 0 4 false - disabled + normal true Image IDs should appear here 25 @@ -239,13 +239,13 @@ 4 1 - 0 - 8 + 1 + 7 - + bottom -500 500 @@ -260,7 +260,7 @@ - + Brightness adjust 0 @@ -270,7 +270,7 @@ - + Dataset path 0 @@ -292,7 +292,7 @@ - + TkIconFont Powered by ARNweb.nl & TomSelier.com @@ -339,6 +339,50 @@ + + + 15 + No tests have been run yet + false + 25 + word + + 5 + 1 + 1 + 7 + + + + + + Metadata + + 4 + 0 + + + + + + Test results + + 5 + 0 + + + + + + Run Tests + + 02 + 2 + 68 + 6 + + + diff --git a/src/helpers/logger.py b/src/helpers/logger.py index a770899..fd8c63f 100644 --- a/src/helpers/logger.py +++ b/src/helpers/logger.py @@ -45,5 +45,4 @@ class Logger: self.data = [] def __del__(self): - print("Log file closed!") self.file.close() diff --git a/src/suite.py b/src/suite.py index 842c590..770fa7b 100644 --- a/src/suite.py +++ b/src/suite.py @@ -88,8 +88,6 @@ class MainApp: """ Close PLT windows on main app quit """ - # TODO: This function runs multiple times for some reason - if plt is not None: plt.close() # Close graph vies log.file.close() # Close log files @@ -137,13 +135,6 @@ class MainApp: # Update UI self.update(self) - """ - TODO: - - Primitive surface area - - Derivative max x and y pos - - Function min, max + y position - """ - def apply(self, event=None, path=None): """ Export current dataset @@ -280,23 +271,22 @@ class MainApp: y_ind = (int)(th1 / canny_step) x_ind = (int)(th2 / canny_step) - # Ignore all edges where th1 > th2 - if th1 <= th2: - # Canny Edge Detection - edges = cv2.Canny(image=img, threshold1=th1, threshold2=th2) - w_res = cv2.countNonZero(edges) - results[y_ind].append(w_res) - else: - results[y_ind].append(0) + # Canny Edge Detection + edges = cv2.Canny(image=img, threshold1=th1, threshold2=th2) + w_res = cv2.countNonZero(edges) + results[y_ind].append(w_res) # print(f"Result at thres {th1}, {th2}; \tIndex {y_ind}, {x_ind} \t= {w_res}") # print(results[y_ind]) func = np.diag(results) + diff = np.diff(func) + area = sum(func) + self.axs[column, row - 1].clear() - self.axs[column, row - 1].title.set_text("Canny F U N C") + self.axs[column, row - 1].title.set_text(F"Area: {area}") self.axs[column, row - 1].plot(func) - self.axs[column, row - 1].plot(np.diff(func)) + self.axs[column, row - 1].plot(diff) self.axs[column, row].title.set_text( f"Mean: {np.matrix(results).mean()}\nStd: {np.matrix(results).std()}" @@ -309,12 +299,15 @@ class MainApp: lambda x, pos: str(x * canny_step) ) - log.add("Canny Mean", np.matrix(results).mean()) - log.add("Canny Std", np.matrix(results).std()) - log.add("Canny Min", np.matrix(results).min()) - log.add("Canny Max", np.matrix(results).max()) - log.add("Canny Diff min", np.diff(func).min()) - log.add("Canny Diff max", np.diff(func).max()) + log.add("Canny Mean", func.mean()) + log.add("Canny Std", func.std()) + log.add("Canny Min", func.min()) + log.add("Canny Max x", np.where(func==func.max())[0][0]) + log.add("Canny Max y", func.max()) + log.add("Canny Diff max y", diff.max()) + log.add("Canny Diff min x",np.where(diff==diff.min())[0][0]) + log.add("Canny Diff min y", diff.min()) + log.add("Canny Area", area) def writeStats(self, img, labels, column, row): mean, std = imgStats(img) @@ -379,7 +372,7 @@ class MainApp: print("Full update forced!") if self.updatePath(): - log.add("Img", self.img_name) + log.add("Tree", self.img_name.split("_")[0]) # Get all user vars ct1 = self.canny_thr1.get()