Skip to content

Commit

Permalink
Updated video sub-package to be compatible with Python 3; made vide…
Browse files Browse the repository at this point in the history
…o using daemon threads
  • Loading branch information
jrosebr1 committed Jan 9, 2016
1 parent e7f5881 commit 4021028
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ imutils/meta.py
imutils/object_detection.py
imutils/paths.py
imutils/perspective.py
imutils/video/__init__.py
imutils/video/fps.py
imutils/video/pivideostream.py
imutils/video/videostream.py
imutils/video/webcamvideostream.py
1 change: 0 additions & 1 deletion imutils/contours.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# import the necessary packages
import cv2


def sort_contours(cnts, method="left-to-right"):
# initialize the reverse flag and sort index
reverse = False
Expand Down
6 changes: 3 additions & 3 deletions imutils/video/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# import the necessary packages
from fps import FPS
from videostream import VideoStream
from webcamvideostream import WebcamVideoStream
from .fps import FPS
from .videostream import VideoStream
from .webcamvideostream import WebcamVideoStream
4 changes: 3 additions & 1 deletion imutils/video/pivideostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def __init__(self, resolution=(320, 240), framerate=32):

def start(self):
# start the thread to read frames from the video stream
Thread(target=self.update, args=()).start()
t = Thread(target=self.update, args=())
t.daemon = True
t.start()
return self

def update(self):
Expand Down
4 changes: 2 additions & 2 deletions imutils/video/videostream.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import the necessary packages
from webcamvideostream import WebcamVideoStream
from .webcamvideostream import WebcamVideoStream

class VideoStream:
def __init__(self, src=0, usePiCamera=False, resolution=(320, 240),
Expand All @@ -10,7 +10,7 @@ def __init__(self, src=0, usePiCamera=False, resolution=(320, 240),
# explicity told to do so -- this helps remove the
# requirement of `picamera[array]` from desktops or
# laptops that still want to use the `imutils` package
from pivideostream import PiVideoStream
from .pivideostream import PiVideoStream

# initialize the picamera stream and allow the camera
# sensor to warmup
Expand Down
4 changes: 3 additions & 1 deletion imutils/video/webcamvideostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def __init__(self, src=0):

def start(self):
# start the thread to read frames from the video stream
Thread(target=self.update, args=()).start()
t = Thread(target=self.update, args=())
t.daemon = True
t.start()
return self

def update(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='imutils',
packages=['imutils', 'imutils.video'],
version='0.3.3',
version='0.3.4',
description='A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, displaying Matplotlib images, sorting contours, detecting edges, and much more easier with OpenCV and both Python 2.7 and Python 3.',
author='Adrian Rosebrock',
author_email='[email protected]',
Expand Down

0 comments on commit 4021028

Please sign in to comment.