|
Author |
Topic: long exposure video (Read 1131 times) |
|
david peña
|
long exposure video
« on: Sep 18th, 2003, 7:57am » |
|
connect your camera and take a (long) look. int ancho = 320; int alto = 240; int area = ancho*alto; int tiempo = 50; void setup() { size(ancho, alto); noBackground(); beginVideo(ancho, alto, 15); } public void videoEvent() { for (int i=0;i<area;i++){ int rojo = int(((red(pixels[i])*(tiempo-1))+red(video.pixels[i]))/tiempo); int verde = int(((green(pixels[i])*(tiempo-1))+green(video.pixels[i]))/tiempo); int azul = int(((blue(pixels[i])*(tiempo-1))+blue(video.pixels[i]))/tiempo); pixels[i] = color(rojo,verde,azul); } } void loop() { }
|
|
|
|
Jerronimo
|
Re: long exposure video
« Reply #1 on: Sep 18th, 2003, 6:05pm » |
|
Very neat effect. I had to decrease the rate a little and move the code out of videoEvent() and into loop() to get it to work for me, but it is a very cool effect. I also put in a mousePressed thing that just draws the current frame to the screen, handy for focusing, as well as showing how the long exposures reduce ccd noise. It's a good way to demonstrate one of the main principles of doing astronomy with CCDs. One of the things you do is to use many long exposures to reduce the effects of CCD noise. (Another thing we do is to move the telescope around so that you capture the same image, but with different CCD elements, then you shift and recombine them later in post-processing...) (yet a third thing to do is to take a "flat field" image... put the lens cap on the camera, take a picture. you now have all of the individual gain levels for each pixel. You can subtract this from every image to eliminate this constant from all of the data... so that when you image something using pixels 10-20, it comes out with the same values as when imaged using pixels 400-410) If you use your webcam in a dark room, click, to start with a noisy single frame. release, then the noise evens out, and you end up with a really sharp, nice picture. Code: int ancho = 320; int alto = 240; int area = ancho*alto; int tiempo = 8; void setup() { size(ancho, alto); noBackground(); beginVideo(ancho, alto, 15); } public void videoEvent() { } void loop() { for (int i=0;i<area;i++) { int rojo = int(((red(pixels[i])*(tiempo-1))+red(video.pixels[i]))/tiempo); int verde = int(((green(pixels[i])*(tiempo-1))+green(video.pixels[i]))/tiempo); int azul = int(((blue(pixels[i])*(tiempo-1))+blue(video.pixels[i]))/tiempo); pixels[i] =color(rojo,verde,azul); } if( mousePressed ) { image( video, 0, 0 ); } } |
|
|
|
|
|
|