I've been looking at modifying another sketch to read and manipulate a folder full of images in sequence but I'm not having much luck.
The modifications I've made to Kim Asendorf's ASDFPixelSort sketch have allowed it to read all the image files in a folder, but not only can I not get it to load the whole list, it doesn't even sort the first image anymore (which is the only file it does load).
Here's my alternation:
int mode = 1;
//MODE:
//0 -> black
//1 -> bright
//2 -> white
//b(16777216)
java.io.FilenameFilter jpgFilter = new java.io.FilenameFilter() {
I'm new to processing as of a week or two and diving in head first!
I've been experimenting with lots of open source pixel sorting sketches and I'm looking to process a batch of still video frames, in .jpg form, for the purpose of recompilation into video. No luck so far and I was wondering if anyone would be willing to point out the error in my code or in the right direction.
I'm getting a
NullPointerException error at the
for line right after my
void draw() statement
thanks in advance for taking a look!
import java.util.Date;
PImage img;
Date d = new Date();
long timestamp = d.getTime()/1000;
File dir = new File(dataPath("images"));
String[] list = dir.list();
void setup() {
size(1080,720);
}
void draw() {
for (int x = 0; x < list.length; x++);{
img = loadImage("list[x]");
}
background(img);
loadPixels();
for (int y = 0; y<height; y+=1 ) {
for (int x = 0; x<width; x+=1) {
int loc = x + y*img.width;
float r = red (img.pixels[loc]);
float g = green (img.pixels[loc]);
float b = blue (img.pixels[loc]);
float av = ((r+g+b)/3.0);
pushMatrix();
translate(x,y);
stroke(r,g,b);
if (r > 30 && r < 255) {
line(0,0,(av-255)/1,0); //change these values to alter the length. The closer to 0 the longer the lines.
// goose note: see 255? the number right after that, which should be 1 by default in my copy, is the easiest one to change for line length. try decimals for longer ones!
// you can also try different shapes or even bezier curves instead of line();