Bu Blogda Ara

12 Ocak 2010 Salı

MA :: dersteki video

Associative Design @ Berlage
http://www.dysturb.net/2007/associative-design-berlage/

video
http://www.youtube.com/watch?v=EhjUli4cYEg&feature=related

30 Aralık 2009 Çarşamba

İki Kamera Color Tracking

İki elim doluyken nasıl screenshot aldım? C: Orkun.

import processing.video.*;
Capture video;
Capture video2;
int[] depobrightestx = new int[2];
int[] depobrightesty = new int[2];
int[] deporedx = new int[2];
int[] deporedy = new int[2];
int[] depobluex = new int[2];
int[] depobluey = new int[2];
int sayac=1;
String[] captureDevices;
String[] alist = new String[100];

void setup() {
size(1280, 480); // Change size to 320 x 240 if too slow at 640 x 480
// Uses the default video input, see the reference if this causes an error
println(Capture.list());
captureDevices=Capture.list();
video = new Capture(this, 640, 480, 30);
video.settings();
video2=new Capture(this,640,480,30);
video2.settings();



noStroke();
smooth();
frameRate(4);
}

void draw() {

if (video.available()) {
video.read();
image(video,0,0);
}
if(video2.available()){
image(video2,640,0);
video2.read();
}
//image(video, 0, 0, width, height); // Draw the webcam video onto the screen
int brightestX = width/2; // X-coordinate of the brightest video pixel
int brightestY = width/2; // Y-coordinate of the brightest video pixel
int redX = width/2;
int redY = width/2;
int blueX = width/2;
int blueY = width/2;
float blueeValue = 128;
float brightestValue =128;
float reddValue = 128;
// Brightness of the brightest video pixel
// Search for the brightest pixel: For each row of pixels in the video image and
// for each pixel in the yth row, compute each pixel's index in the video
loadPixels();
int index = 0;
for (int y = 0; y <>
for (int x = 0; x <>
// Get the color stored in the pixel
int pixelValue = pixels[index];
// Determine the brightness of the pixel
float redValue = red(pixelValue);
float greenValue= green(pixelValue);
float blueValue= blue(pixelValue);

// If that value is brighter than any previous, then store the
// brightness of that pixel, as well as its (x,y) location
if ((greenValue > 140)&&(redValue>140)&&(blueValue<60)){
if (( x !=0) &&( y != 0))
{
brightestValue = redValue;
brightestY = y;
brightestX = x;
}
}

if ((blueValue> 200)&&(greenValue <>
if (( x !=0) && (y != 0)){
blueeValue = blueValue;
blueY = y;
blueX = x;
}
}

if ((redValue > reddValue)&&(blueValue<90)&&(greenvalue<90)){
if (( x !=0) &&( y != 0))
{
reddValue = redValue;
redY = y;
redX = x;
}
}

index++;

}


}
// Draw a large, yellow circle at the brightest pixel

fill(255, 204, 0, 128);
ellipse(brightestX, brightestY, 14, 14);
stroke(0,0,0,120);

fill (255, 0, 0 , 128);
ellipse(redX,redY, 14,14);
fill (0, 50, 200 , 128);
ellipse(blueX,blueY, 14,14);



line(blueX, blueY, brightestX, brightestY);
line(redX, redY, blueX, blueY);
line(brightestX, brightestY, redX, redY);
depobrightestx [sayac] = brightestX ;
depobrightestx = append (depobrightestx,sayac+2);
depobrightesty [sayac] = brightestY ;
depobrightesty = append (depobrightesty,sayac+2);
deporedx [sayac] = redX ;
deporedx = append (deporedx,sayac+2);
deporedy [sayac] = redY ;
deporedy = append (deporedy,sayac+2);
depobluex [sayac] = blueX ;
depobluex = append (depobluex,sayac+2);
depobluey [sayac] = blueY ;
depobluey = append (depobluey,sayac+2);
sayac++;

}

VE GORUNTULER IKIYE KATLANIR


/*
Ikincil Kamera

Cagri Zaman
31 Aralik 09
*/

import processing.video.*;
Capture bir; //kamera nesneleri
Capture iki;

String[] captureDevices;


void setup(){
size(1280,480 );
print(Capture.list());
captureDevices = Capture.list();

bir=new Capture(this,640,480,30);
bir.settings();
iki=new Capture(this,640,480,30);
iki.settings();

}

void draw(){
if(bir.available()){
bir.read();
image(bir,0,0);
}

if(iki.available()){
iki.read();
image(iki,640,0);

}




}

Düzeltme- Sonlu Elemanlar Dizisi

Array lerde kullanılan Expand komutu yanlış. Expand sadece dizinin boyutunu değiştiriyor. Kullanılması gereken komut Append(array,value) olacaktı.