# standard setup
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import cv2
# useful helper function
from helpers import imshow
# load and display an image
img = cv2.imread('coins.jpg')
imshow(img)
# capture a frame from the camera
camera = cv2.VideoCapture(0)
ret, frame = camera.read()
imshow(frame)
camera.release()
# bonus: capture and display multiple frames from the camera
camera = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = camera.read()
cv2.imshow('camera', frame)
if cv2.waitKey(5) == 27:
break
cv2.destroyAllWindows()
camera.release()