[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Okay, so, we are now ready to move on Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to something, pretty, \Ndifferent and exciting Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,um, and what that is, is\Nlooking at moving images Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so we spent all this time saying, okay, \NI could have a blank PImage Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and i could figure out some \Ninteresting algorithmic way Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to set all the pixels of that image Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,or, I could have an image thats coming \Nfrom a file, like frog.jpg Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and i could load that image, and i'll \Nhave all the access to all the pixels Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and i could draw it on the screen \Nand i could manipulate it Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and do all sorts of stuff\Nwhat if, however, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,we could have a camera, \Nthis is my weird drawing of a camera Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and what if i could pull in a live image\Nfrom a camera into my Processing sketch Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,What could I do with that? what if I had a\Nyou know, a movie file? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,could I pull in that movie and play back \Nthat movie in my Processing sketch? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,speeding it up, slowing it down, \Ngoing in reverse Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,how could I-, how does all this \Nstuff work? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,How do we make this happen? So, let's \Nfirst just take the basic transition from Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,flat image file to camera and the way \Nthat we're going to do this Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is with Processing's Capture object\NSo, the Capture object, is part of, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Processing's video package\NNow, I just realized, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,there's kinda a crucial component to this,\Nif you are using, and again, this part of Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the video, sadly, is going to just \Nbecome obsolete in a little while Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but, if you are using the 3.0 alpha series\Nand, hopefully, there will be a beta soon Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,or a final version, this will be true for \Nall the 3.0 version's of Processing Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Let's come over here and look, uh, here, \Nif i go to, Import Library Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,let me just zoom in here\NImport Library >> Add Library Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and i pull this up, you won't, by default,\Nhave the video library, so I'm going to Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,search under Processing, and this is what \Nyou're looking for, you wanna find Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in this contributions manager, 'Video' \Nlibrary by The Processing Foundation Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so, in order to run any of these examples,\Nor, to work with live video Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,or recorded movies in Processing, you need\Nthis particular video library Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in all the previous versions of Processing\Nprior to 3.0, this library came with Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Processing, but its quite a large... large\Nlibrary, also it's maintained and updated Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,on a separate schedule, so by pulling it \Nin separately, all you need to do is, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Hey! Whoa! I haven't actually- Amazing!\NI forgot that i just did a fresh install Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,of Processing here, so, this is-, \Nwe're going to test this out Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you just wanna hit this 'install' button \Nand, uh, while it's downloading Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and should be ready to go, and now,\Nwe're going to have this library! Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,yeah! and then it'll say 'remove', so, if\Nyou don't have the video library, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,make sure you get it (button click)\Nokay, back over here! Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Once you have the video library, you \Nnow have access to the Capture object Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you also have access to the Movie object Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so, Capture being live video from some\Ncamera, that's connected to your computer Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Movie object, you'll use for video files,\Nthat you're loading and playing Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,back in Processing, so Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,here's the thing, the thing that's \Nthe most wonderful about this Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is that, both of these things are PImage's\Nessentially, all the functionality; image, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,pixels, width, height, copy\Nany piece of functionality, you learned, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and practiced, and did with PImage, you \Ncould do exactly the same functionality Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,with Capture and Movie Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the only thing that's different, is when\Nyou load a PImage, like frog.jpg, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,those pixels are never gonna change, \Nunless you change them, right? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that file, that image is a \Nflat, static image Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,those pixels are the pixels Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you could do all the same operations! but\Nwith a Capture object or a Movie object, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,those pixels might be changing according \Nto some schedule, of course, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,we have total control over that schedule, \Nwe could say, give me fresh pixels from Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,the camera, or stop giving me fresh \Npixelsfrom the camera, or, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,advance the next frame of the movie, or,\Ndon't advance the next frame of the movie, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so this is an added piece of the puzzle, \Nthat we'll be able to work with Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,as we start using these classes, so, let's\Nsort of, uh, let's look and see how this Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,would work, there's a couple little\Nnuances here, so, i'm back over here, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and i'm in a sketch, so, this is just a, \Nkind of a simple processing sketch Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that I think we did at some point in an \Nearlier video, I'm loading an image, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I'm drawing it on the screen, \NI'm using a couple things; Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,#1 - you can see I can dynamically resize\Nthe image as i draw it, using the mouse, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,or I could also tint it, meaning, \Nchange its color, so, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,what I want to emphasize in this-, \Njust first part of this video, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is let's make this the Capture object from\Nthe camera, I have a laptop in front of me Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,its not all magic, let's get that image\Nfrom that camera, and let's see that there Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and do all the same stuff for it, \Nso, instead-, the first step is, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,instead of a PImage, I wanna say, \NCapture and I'm gonna say video Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,now notice, as soon as I do that, I get \Nan error message, it says, um, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,if I look at the errors, you can see, \Nthe class Capture does not exist, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,now this needs a little bit of work here,\Nbut it's actually giving me a suggestion Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,which is nice, this is-, Capture and Movie\Nare both part of that Processing video Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,library that we just installed, so even \Nthough I've installed the library Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I have to-, in my code, make an explicit \Nreference that i'm going to use it, so, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I'm just gonna-, Processing will \Nadd this for you automatically, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in a bunch of different ways, \Nbut I'm just gonna do it manually, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so I just need to have an import statement\Nat the top; import processing.video.*; Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,now I have my Capture object, now,\N Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you might think, you would say \Nsomething like: "I said loadImage(), Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so, loadCapture (should work) or \Nsomething? createCapture, connectVideo, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,startVideo", um, the way that \Nthis works however, is, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,there is no function like that, we need to\Nuse the tools and syntax of Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,object oriented programming, \Nso lets come back over here Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and if I have a video object, the syntax \Nis to say, I wanna make a new... Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Capture object, and I need to figure out,\Nwhat goes in there, so, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,what might be some parameters \Nthat you need Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,when you're about to connect to \Nthe live camera? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,maybe you might say: \N"Ah! camera over there! Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I would like a very high resolution image"\Nor "a very low resolution image" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so, some parameters we're going to \Nput in there as the width and the height Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,of our requested, uh-, images \Nthat we'll get from the camera Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,another piece of information that we \Nmight put over here, is... frame rate Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,do i want to get images from the camera \Nat, 30 frames? 60 frames? 120 frames? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,15 frames? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,now, with both of these-, frames per \Nsecond, so, with both of these, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,certain cameras are only \Ngoing to support Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,\Ncertain resolutions and \Ncertain frame rates, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so, a lot of this really depends \Non what you've got, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and I'm going to show \Nyou a way to figure out Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,what your camera makes available to you Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but generally speaking, 640x480, 30 FPS,\Nthose are, kinda good numbers to use, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and in fact, this (meaning >> FPS) \Nis an optional parameter Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,you're just gonna get the default frame \Nrate, if you don't request a specific one, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,which is usually 30 frames per second Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,now, there's another argument \Nthat needs to go in here Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and this is one of those tricky one \Nthat appears, when you're using-, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,a lot of times when you're using a \NProcessing library Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,One of the things we need to do, is, we\Nneed to say: "A Capture object camera", Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"you're (referring to camera) going \Nto have new images available" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"you're looking at the room, \Nyou're looking at me," Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"you know where I want you \Nto give those images?" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,"I want you to give those images to me" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,who's 'me'? \Nthis particular Processing sketch, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,'this' sketch, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,so the keyword 'this' needs to go in here, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,now we could have a much longer discussion\Nabout what the keyword 'this' means Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and Java, and then we can sit here and\Ncomplain for a while Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,about how confusing these, like, archaic\Nconcepts, and like, old-fashioned Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,languages like Java are Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but for-, we don't really need to \Nworry about it too much Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to make all this stuff work, we just need \Nto remember the keyword 'this' goes there Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and I think it's kinda useful, to kind of \Nthink about the fact that 'this' Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is referring to this Processing sketch Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I don't want the camera images to go to\Nsome other program on the computer Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,I want them to go to this Processing \Nsketch, and we're telling the library that Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,this-, this happens in a lot of other ways\Nbehind the scenes in Processing, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but you don't always have \Nto use that keyword 'this'