parent
d7a4ff50f6
commit
538c7e3341
@ -1,9 +0,0 @@
|
||||
import numpy as np
|
||||
|
||||
def imgStats(img):
|
||||
mean = np.zeros(3)
|
||||
std = np.zeros(3)
|
||||
for i in range(img.shape[2]):
|
||||
mean[i] = np.mean(img[:, :, i])
|
||||
std[i] = np.std(img[:, :, i])
|
||||
return mean, std
|
10
src/suite.py
10
src/suite.py
@ -9,7 +9,6 @@ import cv2
|
||||
import time
|
||||
import matplotlib.pyplot as plt
|
||||
import json
|
||||
from helpers.statistics import imgStats
|
||||
|
||||
## UI config load
|
||||
PROJECT_PATH = pathlib.Path(__file__).parent
|
||||
@ -194,13 +193,6 @@ class MainApp:
|
||||
self.axs[column, row].xaxis.set_major_formatter(lambda x, pos: str(x*canny_step))
|
||||
self.axs[column, row].yaxis.set_major_formatter(lambda x, pos: str(x*canny_step))
|
||||
|
||||
def writeStats(self, img, labels, column, row):
|
||||
mean, std = imgStats(img)
|
||||
self.axs[column, row].title.set_text(
|
||||
"mean: %c:%d %c:%d %c:%d \n std: %c:%d %c:%d %c:%d"
|
||||
%(labels[0], mean[0], labels[1], mean[1], labels[2], mean[2],
|
||||
labels[0], std[0], labels[1], std[1], labels[2], std[2]))
|
||||
|
||||
def update(self, event=None):
|
||||
path = self.img_path.get()
|
||||
|
||||
@ -266,7 +258,6 @@ class MainApp:
|
||||
|
||||
if img is not None:
|
||||
self.drawHist(img, ('B', 'G', 'R'), 0, 0)
|
||||
self.writeStats(img, ('B', 'G', 'R'), 0, 0)
|
||||
|
||||
# HSV
|
||||
img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
|
||||
@ -277,7 +268,6 @@ class MainApp:
|
||||
|
||||
if img_hsv is not None:
|
||||
self.drawHist(img_hsv, ('H', 'S', 'V'), 0, 1)
|
||||
self.writeStats(img_hsv, ('H', 'S', 'V'), 0, 1)
|
||||
|
||||
# Canny Heatmap
|
||||
self.drawCannyHM(img, 1, 1)
|
||||
|
Loading…
Reference in New Issue
Block a user