2011年4月15日金曜日

New feature in my program

if (second()%10==0){
 for(int y=0; y<height; y++){
 for(int x=0; x<width; x++){
 if (abs(brightness(motionD[width*y+x])-brightness(get(x,y)))>20){
 counter++;
 }
 motionD[width*y+x]=get(x,y);
 }
 }
 println("Different"+counter);//number of differnt pix
 counter=0;
}

///END

This program check the pixel every 10 second and if the brightnesses are significantly different this program return huge number.

It is possible to apply this program to detect a existence of human in front of static background.

2011年3月15日火曜日

NewProgram

This program allows you to play a movie.

However, in reality, the program can not a play a movie itself but an image sequence.

I rendered 48233 jpeg frames and played with this program. it worked fine.

The each image should be small. In case of mine, they are 50Kb.

If you use good quality JPEG or PNG like 400kb, the processing can not handle them in real time. (my computer has xeon 5355 - 2.66Ghz)

The program requires fullscreen library. If you do not have it, got to http://www.superduper.org/processing/fullscreen_api/ . It basically works good in my workstation. (nvidia quadro 5600)

Also you need to create a font file TimesNewRomanPS-BoldMT-48.vlw


http://www.afterpopgallery.toypark.in/programs/thesis/Movie.txt

2011年1月26日水曜日

2011年1月11日火曜日

Drawing program Ver2 (internal version V3A)

In addition to the drawing ability, this program enable to remember up to 9 drawing.
Try to draw several geometries with left clicks and right click.
After making more than one geometry, hit a 1~9 key of your keyboard.
You will see older geometries.

Because of the system of Blogger, I can not upload the program so that please click the following link to see my program.

http://www.afterpopgallery.toypark.in/programs/drawing-software/

Source Code:

http://www.afterpopgallery.toypark.in/programs/drawing-software/source.txt


Basic drawing program Ver 1.0

Drawing Program

Please do left clicks and if you satisfy, do a right click.

Processing will draw a geometry for you.



generationP SP;

class generationP{
int vertexBrrayX;
int vertexBrrayY;
int counter;

generationP(int x, int y, int c){
counter = c;
vertexBrrayX = x;
vertexBrrayY = y;

}

void DOShape(){
vertex(vertexBrrayX, vertexBrrayY);
}
}


int COUNTER=0;
int switchingC = 0;
int MX, MY;

void setup(){
size(600, 600);
}

void draw(){
if (mousePressed){
line(MX, MY, mouseX, mouseY);
if(mouseButton==LEFT){
if(switchingC==0){
background(200);
beginShape();
switchingC=1;
}


SP=new generationP(mouseX, mouseY, 0);
SP.DOShape();
COUNTER++;
if(COUNTER==100){
endShape();
switchingC=0;
COUNTER=0;
}
MX=pmouseX;
MY=pmouseY;
}else if(mouseButton==RIGHT){
endShape(CLOSE);
switchingC=0;
}
}
}

2011年1月10日月曜日

Sample picture

practice

Practicing Array.

this program will draw ellipses with color.

the scale, location and color of the ellipses will gradually but randomly change.


int[] circle = {100, 120, 30, 90};
float[] colorManager = new float[3];

void setup(){
size(200, 200);
initialColor();
}
void draw(){
for(int i=0; i<=3; i++){
circle[i] += random(-1,2);
}
for(int i=0; i<=2; i++){
colorManager[i] += random(-2,2);
if ((colorManager[i]>255)||(colorManager[i]<0)){
initialColor();
}
}
fill(colorManager[0],colorManager[1],colorManager[2]);
ellipse(circle[0],circle[1],circle[2],circle[3]);
}


void initialColor(){
for(int i=0; i<=2; i++){
colorManager[i] = random(255);
}
}

practice

practicing Array and Class

drawCircle circle;

float[] ra = new float[2];

void setup(){
size(400, 400);
}

void draw(){
background(125);
randomProcess();
circle = new drawCircle(200, 200, ra[0], ra[1]);
circle.drawC();
}


void randomProcess(){
ra[0]=random(100, 200);
ra[1]=random(150, 180);
}

class drawCircle{
int x;
int y;
float vx;
float hy;
drawCircle(int locationX, int locationY, float verticalScale, float horizonalScale){
x = locationX;
y = locationY;
vx = verticalScale;
hy = horizonalScale;
}
void drawC(){
ellipse(x, y, vx, hy);
}
}