fix samples

pull/20326/head
APrigarina 3 years ago
parent 8fad85edda
commit 0f24d4d2a1
  1. 2
      samples/python/gaussian_mix.py
  2. 2
      samples/python/hist.py
  3. 7
      samples/python/morphology.py

@ -28,7 +28,7 @@ def make_gaussians(cluster_n, img_size):
return points, ref_distrs
def draw_gaussain(img, mean, cov, color):
x, y = np.int32(mean)
x, y = mean
w, u, _vt = cv.SVDecomp(cov)
ang = np.arctan2(u[1, 0], u[0, 0])*(180/np.pi)
s1, s2 = np.sqrt(w)*3.0

@ -46,7 +46,7 @@ def hist_lines(im):
im = cv.cvtColor(im,cv.COLOR_BGR2GRAY)
hist_item = cv.calcHist([im],[0],None,[256],[0,256])
cv.normalize(hist_item,hist_item,0,255,cv.NORM_MINMAX)
hist=np.int32(np.around(hist_item))
hist = np.int32(np.around(hist_item))
for x,y in enumerate(hist):
cv.line(h,(x,0),(x,y[0]),(255,255,255))
y = np.flipud(h)

@ -50,8 +50,11 @@ def main():
cur_str_mode = str_modes.next()
def update(dummy=None):
sz = cv.getTrackbarPos('op/size', 'morphology')
iters = cv.getTrackbarPos('iters', 'morphology')
try: # do not get trackbar position while trackbar is not created
sz = cv.getTrackbarPos('op/size', 'morphology')
iters = cv.getTrackbarPos('iters', 'morphology')
except:
return
opers = cur_mode.split('/')
if len(opers) > 1:
sz = sz - 10

Loading…
Cancel
Save