1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

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
+8 -8
View File
@@ -13,7 +13,7 @@ Press any key to continue, ESC to stop.
from __future__ import print_function
import numpy as np
import cv2
import cv2 as cv
def inside(r, q):
@@ -27,7 +27,7 @@ def draw_detections(img, rects, thickness = 1):
# the HOG detector returns slightly larger rectangles than the real objects.
# so we slightly shrink the rectangles to get a nicer output.
pad_w, pad_h = int(0.15*w), int(0.05*h)
cv2.rectangle(img, (x+pad_w, y+pad_h), (x+w-pad_w, y+h-pad_h), (0, 255, 0), thickness)
cv.rectangle(img, (x+pad_w, y+pad_h), (x+w-pad_w, y+h-pad_h), (0, 255, 0), thickness)
if __name__ == '__main__':
@@ -37,15 +37,15 @@ if __name__ == '__main__':
print(__doc__)
hog = cv2.HOGDescriptor()
hog.setSVMDetector( cv2.HOGDescriptor_getDefaultPeopleDetector() )
hog = cv.HOGDescriptor()
hog.setSVMDetector( cv.HOGDescriptor_getDefaultPeopleDetector() )
default = ['../data/basketball2.png '] if len(sys.argv[1:]) == 0 else []
for fn in it.chain(*map(glob, default + sys.argv[1:])):
print(fn, ' - ',)
try:
img = cv2.imread(fn)
img = cv.imread(fn)
if img is None:
print('Failed to load image file:', fn)
continue
@@ -64,8 +64,8 @@ if __name__ == '__main__':
draw_detections(img, found)
draw_detections(img, found_filtered, 3)
print('%d (%d) found' % (len(found_filtered), len(found)))
cv2.imshow('img', img)
ch = cv2.waitKey()
cv.imshow('img', img)
ch = cv.waitKey()
if ch == 27:
break
cv2.destroyAllWindows()
cv.destroyAllWindows()