emailconfirmed
1,824
edits
(image processing code) |
(add image capture code) |
||
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 ===== | ||