We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have made this code to make our face star, triangle, or rectangle pixels on webcam. but the processing program keeps saying that there is no library found for krister.Ess Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder. I have already downloaded and put this in a libraries inside the sketchbook folder. I don't know what is the problem. Please help me! The code below is what I made.
PImage img;
PImage pnimg;
import processing.video.*;
import krister.Ess.*;
FFT myfft;
AudioInput myinput;
int bufferSize=512;
import processing.video.*;
// Size of each cell in the grid
int cellSize = 8;
// Number of columns and rows in our system
int cols, rows;
// Variable for capture device
Capture video;
PShape star;
int status = 0;
int ready = 0;
int count = 0;
void setup() {
size(1024,768,P3D);
background(0, 102, 153);
img = loadImage ("back06.jpg");
// Set up columns and rows
cols = width/2 / cellSize;
rows = height/2 / cellSize;
//colorMode(RGB, 255, 255, 255, 70);
// ellipseMode(CENTER);
// Uses the default video input, see the reference if this causes an error
video = new Capture(this, 640, 480);
video.start();
frameRate(45);
//filter(BLUR,30);
smooth();
Ess.start(this);
myinput=new AudioInput(bufferSize);
myfft=new FFT(bufferSize*2);
myinput.start();
myfft.damp(.1);
myfft.equalizer(true);
myfft.limits(.005,.01);
}
void draw() {
tint(255,70);
image(img,0,0);
float percent= myfft.averages[0];
if (video.available()) {
video.read();
video.loadPixels();
// Begin loop for columns
for (int i = 0; i < cols;i++) {
// Begin loop for rows
for (int j = 0; j < rows;j++) {
// Where are we, pixel-wise?
int x = i*cellSize + cellSize/2;
int y = j*cellSize + cellSize/2;
int loc = (video.width - x - 1) + y*video.width; // Reversing x to mirror the image
// Each rect is colored white with a size determined by brightness
color c = video.pixels[loc];
float sz = ((percent)*5000/ float(width)) * brightness(video.pixels[loc]) + 80.0;
float sy = brightness(video.pixels[loc])+20.0;
pushMatrix();
println("percent : "+percent);
if(percent < 0.2 )
{
ready = 1;
}
if (count > 30 ) count = 0;
if(ready == 1)
{
if(percent>0.6 && status == 0){
status = 1;
ready = 0;
}
else if(percent>0.6 && status == 1){
status = 2;
ready = 0;
}
else if(percent>0.6 && status == 2){
status = 3;
ready = 0;
}
else if(percent>0.6 && status == 3){
status = 0;
ready = 0;
}
}
if(status == 0)
{
translate(x , y , sz);
fill(c);
noStroke();
ellipse(x , y ,cellSize*sz/100, cellSize*sz/100);
}
else if (status == 1)
{
translate(x*2 , y*2 , sz);
fill(c);
noStroke();
triangle(0,0,cellSize*sz/100,0,cellSize*sz/100/2,cellSize*sz/100);
triangle(cellSize*sz/100/2,-5,cellSize*sz/100,(cellSize*sz/100)-2,0,(cellSize*sz/100)-5);
}
else if (status == 2)
{
translate(x , y , sz);
fill(c);
noStroke();
rect(x , y ,cellSize*sz/100, cellSize*sz/100);
}else if (status == 3)
{
translate(x*2 , y*2 , sz);
fill(c);
noStroke();
triangle(0,0,cellSize*sz/100,0,cellSize*sz/100/2,cellSize*sz/100);
}
//count ++;
popMatrix();
}
}
}
}
public void audioInputData(AudioInput theInput) {
myfft.getSpectrum(myinput);
}
Answers
Since Processing is saying that it can't find the library then it is either a problem with the import statement or the library has been placed in the wrong folder. It is NOT caused by errors in your source code. (When posting code in this forum, select the code and press K or click on the C button).
The problem is almost certainly that you have put the library in the wrong place. It should be