mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
samples: fix python samples compatibility with demo.py
This commit is contained in:
@@ -9,9 +9,10 @@ if PY3:
|
||||
xrange = range
|
||||
|
||||
import numpy as np
|
||||
from numpy import random
|
||||
import cv2 as cv
|
||||
|
||||
from numpy import random
|
||||
|
||||
def make_gaussians(cluster_n, img_size):
|
||||
points = []
|
||||
ref_distrs = []
|
||||
@@ -34,7 +35,7 @@ def draw_gaussain(img, mean, cov, color):
|
||||
cv.ellipse(img, (x, y), (s1, s2), ang, 0, 360, color, 1, cv.LINE_AA)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
cluster_n = 5
|
||||
img_size = 512
|
||||
|
||||
@@ -66,4 +67,11 @@ if __name__ == '__main__':
|
||||
ch = cv.waitKey(0)
|
||||
if ch == 27:
|
||||
break
|
||||
|
||||
print('Done')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(__doc__)
|
||||
main()
|
||||
cv.destroyAllWindows()
|
||||
|
||||
Reference in New Issue
Block a user