Bu Blogda Ara

20 Aralık 2009 Pazar

örnek kodun text dosyasına dönüştürülmesi

import processing.video.*;

Capture video;
String[] alist = new String[100];

void setup() {
size(800, 600); // 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
video = new Capture(this, width, height, 30);
noStroke();
smooth();
frameRate(4);
}

void draw() {
if (video.available()) {
video.read();
//image(video, 0, 0, width, height); // Draw the webcam video onto the screen
int brightestX = 0; // X-coordinate of the brightest video pixel
int brightestY = 0; // Y-coordinate of the brightest video pixel
int redX =0;
int redY = 0;
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
video.loadPixels();
int index = 0;
for (int y = 0; y < x =" 0;" style="font-weight: bold;"> // Get the color stored in the pixel
int pixelValue = video.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 > 200)&&(redValue>200)&&(blueValue< brightestvalue =" redValue;" brightesty =" y;" brightestx =" x;"> reddValue)&&(blueValue<70)&&(greenvalue<70)){ reddvalue =" redValue;" redy =" y;" redx =" x;" style="font-weight: bold;">// Draw a large, yellow circle at the brightest pixel
fill(255, 204, 0, 128);
ellipse(brightestX, brightestY, 50, 50);
fill (255, 0, 0 , 128);
ellipse(redX,redY, 50,50);

//text dosyasına dönüştürme süreci

String valbrightestX = Integer.toString (brightestX);
String valbrightestY = Integer.toString(brightestY);
String valredX = Integer.toString (redX);
String valredY = Integer.toString (redY);
String b = ("-");
String kal = (valbrightestX+b+valbrightestY+b+b+valredX+b+valredY+b+b+b+b);
println (valbrightestX) ;
alist= append (alist, kal);

saveStrings("nouns.txt", alist);

}
}



-----------------------------------------------------------------------------------

örnek text verisi.....

null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
0-0--0-0----
0-0--0-0----
0-0--122-472----
238-517--0-0----
244-288--0-0----
0-0--0-0----
0-0--0-0----
511-177--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
284-326--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
0-0--0-0----
547-129--0-0----
285-598--0-0----
0-0--0-0----
0-0--0-0----

Hiç yorum yok:

Yorum Gönder