Edit: Data can be downloaded from here, forgot it again.
Hi,
Sorry for the complete rebuild, but what I wrote was garbage, i’ll try to simplify.
I’m visualising movie color data from three places on the screen, I have the data and drawing working.
The problem is that the data from the center of the screen is, for lack of a better term, stuttering, as shown below.
_M (stutter):
_L:
_R:
The program calculates how many pixels it needs from each line of the file in order to fit on the screen, gets them and moves on to the next line. This is always broken for the center of the screen, not always for the _L or _R data.
My thought is that it could be caused by the line wrapping across the edge of the PImage as if you hardcode the pxls value, the stuttering only happens at values above 10, but I could be wrong about the line wrapping as the _L and _R has minimal “stuttering”.
Is this something i’m doing wrong in the code?
Code example:
IntList colors;
PImage g;
float dispW, dispH;
int pxls = 0, numFrames = 0;
void setup() {
fullScreen();
colorMode(255, 255, 255, RGB);
colors = new IntList();
g = createImage(width, height, RGB);
String[] t = loadStrings("png_ColourDataHSB_R.txt");
numFrames = t.length;
init();
for (int k = 0; k < t.length; k++) {
String temp = t[k];
String[] frames = split(temp, ";");
for (int i = 1; i < pxls; i++) colors.append(int(frames[i])); // starts from 1 as first line is ;
}
for (int i = 0; i < colors.size(); i++) {
g.loadPixels();
g.pixels[i] = colors.get(i);
g.updatePixels();
}
colors.clear();
}
void draw() {
image(g, 0, 0);
}
void init() {
dispW = width;
dispH = height;
pxls = int(ceil((dispW*dispH) / numFrames));
//pxls = 19;
println(pxls);
}
Or could there be a problem in the capture for the _M data itself? (not a complete working example)
int start = (i.pixels.length/2)-(pxls/2);
for (int x = start; x < start+pxls; x++) {
// The functions hue(), sat(), and brightness() pull out the 3 color components from a pixel.
float h = hue(i.pixels[x]);
float s = saturation(i.pixels[x]);
float b = brightness(i.pixels[x]);