from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2

#initialize the camera and grab a reference to the raw camera capture

camera = PiCamera()
rawCapture = PiRGBArray(camera)

#allow camera to warmup
time.sleep(0.1)

#grab an image from camera
camera.capture(rawCapture, format = "bgr")
image = rawCapture.array

#display the image on screen and wait for a keypress
#cv2.imshow("image",image)
#cv2.waitkey(0)
cv2.imwrite('image.jpg',image)
