Add morphology python test, fix python3 compabtibility in kmeans test

This commit is contained in:
Vladislav Sovrasov
2016-01-29 13:07:08 +03:00
parent 56571561b4
commit aaa43dc84f
4 changed files with 57 additions and 8 deletions

View File

@@ -10,10 +10,13 @@ from __future__ import print_function
import numpy as np
import cv2
from numpy import random
import sys
PY3 = sys.version_info[0] == 3
if PY3:
xrange = range
from tests_common import NewOpenCVTests
def make_gaussians(cluster_n, img_size):
points = []
ref_distrs = []
@@ -53,12 +56,6 @@ class kmeans_test(NewOpenCVTests):
cluster_n = 5
img_size = 512
# generating bright palette
colors = np.zeros((1, cluster_n, 3), np.uint8)
colors[0,:] = 255
colors[0,:,0] = np.arange(0, 180, 180.0/cluster_n)
colors = cv2.cvtColor(colors, cv2.COLOR_HSV2BGR)[0]
points, _, clusterSizes = make_gaussians(cluster_n, img_size)
term_crit = (cv2.TERM_CRITERIA_EPS, 30, 0.1)