mirror of
https://github.com/opencv/opencv.git
synced 2026-07-28 23:03:03 +04:00
python: 'cv2.' -> 'cv.' via 'import cv2 as cv'
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# Python 2/3 compatibility
|
||||
from __future__ import print_function
|
||||
|
||||
import cv2
|
||||
import cv2 as cv
|
||||
import numpy as np
|
||||
|
||||
from tests_common import NewOpenCVTests
|
||||
@@ -15,16 +15,16 @@ class TestGoodFeaturesToTrack_test(NewOpenCVTests):
|
||||
threshes = [ x / 100. for x in range(1,10) ]
|
||||
numPoints = 20000
|
||||
|
||||
results = dict([(t, cv2.goodFeaturesToTrack(arr, numPoints, t, 2, useHarrisDetector=True)) for t in threshes])
|
||||
results = dict([(t, cv.goodFeaturesToTrack(arr, numPoints, t, 2, useHarrisDetector=True)) for t in threshes])
|
||||
# Check that GoodFeaturesToTrack has not modified input image
|
||||
self.assertTrue(arr.tostring() == original.tostring())
|
||||
# Check for repeatability
|
||||
for i in range(1):
|
||||
results2 = dict([(t, cv2.goodFeaturesToTrack(arr, numPoints, t, 2, useHarrisDetector=True)) for t in threshes])
|
||||
results2 = dict([(t, cv.goodFeaturesToTrack(arr, numPoints, t, 2, useHarrisDetector=True)) for t in threshes])
|
||||
for t in threshes:
|
||||
self.assertTrue(len(results2[t]) == len(results[t]))
|
||||
for i in range(len(results[t])):
|
||||
self.assertTrue(cv2.norm(results[t][i][0] - results2[t][i][0]) == 0)
|
||||
self.assertTrue(cv.norm(results[t][i][0] - results2[t][i][0]) == 0)
|
||||
|
||||
for t0,t1 in zip(threshes, threshes[1:]):
|
||||
r0 = results[t0]
|
||||
@@ -33,7 +33,7 @@ class TestGoodFeaturesToTrack_test(NewOpenCVTests):
|
||||
self.assertTrue(len(r0) > len(r1))
|
||||
# Increasing thresh should monly truncate result list
|
||||
for i in range(len(r1)):
|
||||
self.assertTrue(cv2.norm(r1[i][0] - r0[i][0])==0)
|
||||
self.assertTrue(cv.norm(r1[i][0] - r0[i][0])==0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user