emailconfirmed
1,824
edits
|  (image processing code) | No edit summary | ||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| ===== Image Capture ===== | |||
| Image capture with //Processing//. | |||
| <pre style="font-size: smaller"> | |||
| add_library('video') | |||
| video = Capture(this, 640, 480) | |||
| fps = 100 | |||
| global recording | |||
| recording = False | |||
| def setup(): | |||
|     # setup video and canvas | |||
|     video.start() | |||
|     size(video.width, video.height) | |||
|     frameRate(fps) | |||
|     # red text | |||
|     fill(255, 0, 0) | |||
| def draw(): | |||
|     # load frame from webcam | |||
|     video.read() | |||
|     # show frame on screen | |||
|     image(video, 0, 0) | |||
|     # save frame to disk | |||
|     if recording == True: | |||
|         saveFrame("video_#######.png") | |||
|         if frameCount % fps < fps/2: | |||
|             text("RECORD", width - 50, 20) | |||
|     # can we keep up with the framerate ? | |||
|     if frameRate < (fps - 1): | |||
|         print "Warning. Can only record with %i fps" % frameRate | |||
| def keyPressed(): | |||
|     global recording  | |||
|     recording = not recording | |||
| def mousePressed(): | |||
|     global recording  | |||
|     recording = not recording | |||
| </pre> | |||
| ===== Image Processing ===== | ===== Image Processing ===== | ||
| ==== Foreground Separation ==== | ==== Foreground Separation ==== | ||
| Simple  | Simple foreground separation with //Processing//. | ||
| Line 32: | Line 86: | ||
| image(img, 0, 0, width, height) | image(img, 0, 0, width, height) | ||
| </pre> | </pre> | ||
| ==== Links ==== | |||
| * [https://opencv-python-tutroals.readthedocs.org Python + OpenCV] | |||