I'm working through Shiffman's Nature of Code book, and quite early on he is making use of Processing's default Java library and the Random function, along with nextGaussian. These work fine in Processing 1.5.1 but I can't seem to get them to work at all in Processing 2.0b8. I'm guessing it should work, as the Java library should still be there?
Here is the sketch:
Random generator;
void setup() {
size(640, 640);
generator = new Random();
background(255);
}
void draw(){
float numx = (float) generator.nextGaussian();
float numy = (float) generator.nextGaussian();
float sd = 60;
float mean = 320;
float x = sd * numx + mean;
float y = sd * numy + mean;
noStroke();
fill(0,10);
ellipse(x,y,16,16);
}
Processing 2.0b8 on Mac OSX... I can't figure it out.
I'm new to Processing and I've spent the last week just following tutorials and playing around. I want to make some kind of surveillance program eventually, but for now I'm trying to get my head around face tracking using OpenCV.
I've just hashed together a simple program which places a 'mask' over the users face - shown below. My current issue is that when I scale the capture size up, it slows it down quite considerably. Is there a way to speed it all up?
I found
this post about the '
You Are Einstein' programme which ultimately achieves what I want to, but it all seems quite complex compared to my simple code. If someone could perhaps explain the principles as to why mine is slow and how to speed it up, I would be very grateful!
Any other tips or pointers in the right direction regarding face tracking, OpenCV or anything relevant would be amazing.