Skip to content

Commit bf9016d

Browse files
committed
python3 for camera
1 parent c8acfd8 commit bf9016d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

camera/read_camera.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import cv2
33
import redis
44
try:
5-
import urlparse
5+
import urllib.parse
66
except ImportError:
77
import urllib.parse as urlparse
88

@@ -17,7 +17,7 @@ def __iter__(self):
1717
self.count = -1
1818
return self
1919

20-
def next(self): # Python 2.7
20+
def __next__(self): # Python 2.7
2121
self.count += 1
2222

2323
# Read image
@@ -44,7 +44,7 @@ def __len__(self):
4444
args = parser.parse_args()
4545

4646
# Set up Redis connection
47-
url = urlparse.urlparse(args.url)
47+
url = urllib.parse.urlparse(args.url)
4848
conn = redis.Redis(host=url.hostname, port=url.port)
4949
if not conn.ping():
5050
raise Exception('Redis unavailable')
@@ -61,4 +61,4 @@ def __len__(self):
6161
'image': data.tobytes()
6262
}
6363
_id = conn.execute_command('xadd', args.output, 'MAXLEN', '~', '1000', '*', 'count', msg['count'], 'img', msg['image'])
64-
print('count: {} id: {}'.format(count, _id))
64+
print(('count: {} id: {}'.format(count, _id)))

camera/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
opencv-python>4.0,<4.1
22
redis==3.2.1
3+
numpy>=1.17.1

0 commit comments

Comments
 (0)