mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Drop Python2 support.
This commit is contained in:
@@ -12,11 +12,6 @@ Keys:
|
||||
ESC - exit
|
||||
'''
|
||||
|
||||
# Python 2/3 compatibility
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
import numpy as np
|
||||
import cv2 as cv
|
||||
|
||||
@@ -42,12 +37,8 @@ def main():
|
||||
modes = cycle(['erode/dilate', 'open/close', 'blackhat/tophat', 'gradient'])
|
||||
str_modes = cycle(['ellipse', 'rect', 'cross'])
|
||||
|
||||
if PY3:
|
||||
cur_mode = next(modes)
|
||||
cur_str_mode = next(str_modes)
|
||||
else:
|
||||
cur_mode = modes.next()
|
||||
cur_str_mode = str_modes.next()
|
||||
cur_mode = next(modes)
|
||||
cur_str_mode = next(str_modes)
|
||||
|
||||
def update(dummy=None):
|
||||
try: # do not get trackbar position while trackbar is not created
|
||||
@@ -84,15 +75,9 @@ def main():
|
||||
if ch == 27:
|
||||
break
|
||||
if ch == ord('1'):
|
||||
if PY3:
|
||||
cur_mode = next(modes)
|
||||
else:
|
||||
cur_mode = modes.next()
|
||||
cur_mode = next(modes)
|
||||
if ch == ord('2'):
|
||||
if PY3:
|
||||
cur_str_mode = next(str_modes)
|
||||
else:
|
||||
cur_str_mode = str_modes.next()
|
||||
cur_str_mode = next(str_modes)
|
||||
update()
|
||||
|
||||
print('Done')
|
||||
|
||||
Reference in New Issue
Block a user