def detect_motion_new(): try: _webcam = Webcamera() winName = "Movement Indicator" cv2.namedWindow(winName, cv2.WINDOW_NORMAL) _webcam.detect_motion_new(winName) except Exception as ex: print(ex)
def capture_and_show(): try: _webcam = Webcamera() _webcam.OnCapture += printevent _webcam.OnCaptureComplete += printcomplete _webcam.capture(40, 0.005, False) _webcam.plot_history_intensity() print(_webcam.history) except Exception as ex: print('Could not save image to file') print(ex)
def test(): try: _webcam = Webcamera() winName = "Event Indicator" cv2.namedWindow(winName, cv2.WINDOW_NORMAL) while True: time.sleep(1) try: img, funk = _webcam.funkyfy() cv2.imshow(winName, numpy.hstack([img, funk])) except: print('Error') key = cv2.waitKey(10) if key == 27: cv2.destroyWindow(winName) break except Exception as ex: print(ex)
def detect_motion(): try: _webcam = Webcamera() winName = "Movement Indicator" cv2.namedWindow(winName, cv2.WINDOW_NORMAL) while True: #time.sleep(1) try: moveit, img = _webcam.detect_motion() cv2.imshow(winName, img) print('Movement detected {0}'.format(moveit)) except Exception as ex: print('Error') key = cv2.waitKey(10) if key == 27: cv2.destroyWindow(winName) break except Exception as ex: print(ex)
def detect_events(): try: _webcam = Webcamera() print(_webcam.image_most_common_colour(Image.open('nopeeps_day.jpg')) ) winName = "Event Indicator" cv2.namedWindow(winName, cv2.WINDOW_NORMAL) while True: time.sleep(1) try: moveit, num, img = _webcam.detect_event() cv2.imshow(winName, img) print('Event detected {0}, Events: {1}'.format(moveit, num)) except: print('Error') key = cv2.waitKey(10) if key == 27: cv2.destroyWindow(winName) break except Exception as ex: print(ex)