From 3e704aca7adc9aef7bb8e6faba8f43f52bcb3578 Mon Sep 17 00:00:00 2001 From: Ashutoshh Date: Sat, 23 Jun 2018 11:42:00 +0530 Subject: [PATCH] Add files via upload image capture with draw pattern --- camera.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 camera.py diff --git a/camera.py b/camera.py new file mode 100644 index 0000000..002b2b1 --- /dev/null +++ b/camera.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import cv2 +import random +# now starting cam + +cap=cv2.VideoCapture(0) + +while cap.isOpened() : + print "camera is working" + status,frame=cap.read() + bwimg=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY) + cv2.rectangle(frame,(100,100),(200,200),(0,0,255),2) + font=cv2.FONT_HERSHEY_SIMPLEX + cv2.putText(frame,'classroom',(100,100),font,2,(255,0,0),cv2.line_AA) + cv2.imshow("camera1",frame) + x=random.random() + y=str(x)[2:6] + cv2.imwrite('adhoc'+y+'.jpg',frame) + #cv2.imshow("camera2",bwimg) + if cv2.waitKey(1) & 0xFF == ord('q') : + break + +cv2.destroyAllWindows() +cap.release() + +