Skip to content

Commit

Permalink
handling camera not connecting
Browse files Browse the repository at this point in the history
  • Loading branch information
jungkumseok committed Dec 31, 2016
1 parent e95cd34 commit 69dfb08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class WebCam(threading.Thread):
def __init__(self, framerate=15):
threading.Thread.__init__(self)
self.framerate = framerate
self.camera = cv2.VideoCapture(-1)
si = -1
self.camera = cv2.VideoCapture(si)
while not self.camera.isOpened():
si = si + 1
self.camera = cv2.VideoCapture(si)
self.raw_image = None
self.gray_image = None
self.image = None
Expand Down
1 change: 0 additions & 1 deletion start.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class CapturedFilesHandler(tornado.web.RequestHandler):
def get(self, page):
page = int(page)
flist = os.listdir('static/captured')
print(flist)
files = [f.split('.')[0] for f in flist if os.path.isfile(os.path.join('static/captured', f)) and f.split('.')[1] == 'mp4']
files = list(reversed(sorted(files)))
si = (page - 1) * 10 if page > 0 else 0
Expand Down

0 comments on commit 69dfb08

Please sign in to comment.