madekan
YaBB Newbies
Offline
Posts: 18
Re: colorize text with live capture.
Reply #10 - Jun 12th , 2007, 10:12am
Yes I know that I must use "txt" files. It was just or the example. Now, my code works. But I have a last problem. My purpose is to use the live capture to "illumate" the text. For example, in a dark room with a infra-red camera, a man enter and his shape in the screen is create by letters of the text, like this : yes gfg fs very j gfd fdf ok f gfg ghjfkdlfdlfldffgfdgfdgfdsdf ,kfldkfldgkfdkgf jfkdjgkfdjgkfdjk fdsfdsfdsfdsfd fdfdsfdsfdsfd fdsfdsfdsfdf fdsf fdsf fdsf fdd My drawing is beautiful! So, with this code, I tried to interpet the luminosity and colour of the live capture as the colour of each character. But now, with this code, the luminosity and the colour of the video is assigned (english?) to the whole text and not to each characters... How can I do? the code : import processing.video.*; int cellsize = 100; int cols = 10; int rows = 10; Capture video; PFont font; String lines[]; void setup() { size(400, 400); frameRate(30); video = new Capture (this, 80, 60, 15); font = loadFont("Verdana.vlw"); textFont(font,5); lines = loadStrings ("mytext.txt"); } void captureEvent (Capture camera){ camera.read(); } void draw() { background(0); textFont(font, 10); int xstep = video.width / rows; int ystep = video.height / cols; for (int j=0; j<cols; j++){ int y = j * ystep; for (int i=0; i<cols; i++) { int x = i * xstep; int loc = x + y * video.width; float r = red(video.pixels[loc]); float g = green(video.pixels[loc]); float b = blue(video.pixels[loc]); color c = color(r,g,b,75); fill(c); } } for (int t=0; t<lines.length; t++){ text(lines[t]+"\n", width, (t*35)); t++; } for (int t=0; t<lines.length; t++){ int g = 30; text(lines[t],g, 60); t++; for (int m = 1; m < video.width; m++) { translate(0,8/0.5); } } }