python: 'cv2.' -> 'cv.' via 'import cv2 as cv'

This commit is contained in:
Alexander Alekhin
2017-12-11 12:55:03 +03:00
parent 9665dde678
commit 5560db73bf
162 changed files with 2083 additions and 2084 deletions
+10 -10
View File
@@ -21,7 +21,7 @@ if PY3:
xrange = range
import numpy as np
import cv2
import cv2 as cv
# built-in modules
import sys
@@ -34,7 +34,7 @@ if __name__ == '__main__':
if len(sys.argv) > 1:
fn = sys.argv[1]
print('loading %s ...' % fn)
img = cv2.imread(fn)
img = cv.imread(fn)
if img is None:
print('Failed to load fn:', fn)
sys.exit(1)
@@ -45,21 +45,21 @@ if __name__ == '__main__':
img = np.zeros((sz, sz), np.uint8)
track = np.cumsum(np.random.rand(500000, 2)-0.5, axis=0)
track = np.int32(track*10 + (sz/2, sz/2))
cv2.polylines(img, [track], 0, 255, 1, cv2.LINE_AA)
cv.polylines(img, [track], 0, 255, 1, cv.LINE_AA)
small = img
for i in xrange(3):
small = cv2.pyrDown(small)
small = cv.pyrDown(small)
def onmouse(event, x, y, flags, param):
h, _w = img.shape[:2]
h1, _w1 = small.shape[:2]
x, y = 1.0*x*h/h1, 1.0*y*h/h1
zoom = cv2.getRectSubPix(img, (800, 600), (x+0.5, y+0.5))
cv2.imshow('zoom', zoom)
zoom = cv.getRectSubPix(img, (800, 600), (x+0.5, y+0.5))
cv.imshow('zoom', zoom)
cv2.imshow('preview', small)
cv2.setMouseCallback('preview', onmouse)
cv2.waitKey()
cv2.destroyAllWindows()
cv.imshow('preview', small)
cv.setMouseCallback('preview', onmouse)
cv.waitKey()
cv.destroyAllWindows()