Exported app runs on my computer but not another
in
Integration and Hardware
•
3 years ago
This app, when exported, runs as expected on my machine. It doesn't run on my girlfriend's machine, though. I've tried the trick of moving the "java" folder from the Processing app into the sketch folder on her computer with no luck (although she and I are both running Snow Leopard, so Java should be a-ok without that).
Any tricks I need to know about? Any problems in this code that might keep it from exporting properly?
Thanks...
- import processing.video.*;
- import ddf.minim.analysis.*;
- import ddf.minim.*;
- import hypermedia.video.*;
- Minim minim;
- AudioInput in;
- OpenCV opencv;
- PImage bkgdImg;
- PImage trailsImg;
- PImage camImage;
- int hCycle;
- float audioAmp = 0.0;
- float sampleAmp;
- int w = 640;
- int h = 480;
- //int w = screen.width;
- //int h = screen.height;
- int COLOR_SPACE = OpenCV.RGB;
- int vidFactor = 1;
- color currColor;
- public void setup() {
- // size(screen.width, screen.height, P3D);
- size(640, 480, P2D);
- frame.setBackground(new java.awt.Color(0, 0, 0));
- frame.setTitle("can you hear me | 2010 | charlie williams");
- background(0);
- opencv = new OpenCV(this);
- minim = new Minim(this);
- minim.debugOn();
- in = minim.getLineIn(Minim.STEREO, 64);
- opencv.capture(w, h);
- trailsImg = new PImage(w, h);
- bkgdImg = new PImage(w, h);
- }
- public void draw() {
- // AUDIO ANALYSIS
- audioAmp *= 0.8;
- for(int i = 0; i < in.bufferSize() - 1; i++) {
- sampleAmp = abs(in.mix.get(i));
- audioAmp += sampleAmp;
- }
- vidFactor = int(audioAmp*20);
- if(vidFactor > 255) {
- vidFactor = 255;
- }
- // if(audioAmp > 32) {
- // audioAmp = 32;
- // }
- // VIDEO ANALYSIS
- opencv.read();
- opencv.flip(OpenCV.FLIP_HORIZONTAL);
- alphize();
- blend(0, 0, w, h, 0, 0, w, h, OVERLAY);
- fill(0, 255-vidFactor);
- rect(0, 0, w, h);
- blend(bkgdImg, 0, 0, w, h, 0, 0, w, h, SCREEN);
- trails();
- }
- public void alphize() {
- camImage = opencv.image();
- loadPixels();
- for (int i = 0; i < h * w; i++) {
- currColor = camImage.pixels[i];
- //clear alpha channel since it comes in as FF:
- currColor = 0x00FFFFFF & currColor;
- pixels[i] = 0x00000000 | (vidFactor << 24) | currColor;
- }
- updatePixels();
- // println(hex(pixels[1]) + " " + vidFactor + " " + hex(currColor));
- }
- public void trails() {
- opencv.read();
- PImage movImage;
- movImage = opencv.image();
- opencv.absDiff();
- opencv.convert( OpenCV.GRAY );
- opencv.blur( OpenCV.BLUR, 3 ); // I like to blur before taking the difference
- // image to reduce camera noise
- opencv.threshold( 90 ); //was 20 originally
- // Tinting the trails. Doesn't work. Why?
- colorMode(HSB);
- tint(color(hCycle, 100, 10));
- blend(trailsImg, 0, 0, w, h, 0, 0, w, h, SCREEN);
- noTint();
- colorMode(RGB);
- opencv.flip(OpenCV.FLIP_HORIZONTAL);
- trailsImg.blend(opencv.image(), 0, 0, w, h, 0, 0, w, h, SCREEN);
- //handles fading the trails over time
- opencv.copy( trailsImg );
- opencv.blur( OpenCV.BLUR, 20 ); //was 4
- opencv.brightness( -20 );
- trailsImg = opencv.image();
- opencv.remember();
- hCycle++;
- if (hCycle > 255) {
- hCycle = 0;
- }
- }
- public void keyPressed() {
- println(keyCode);
- switch(keyCode) {
- case 8:
- bkgdImg.loadPixels();
- for (int i = 0; i < h * w; i++) {
- bkgdImg.pixels[i] = 0;
- }
- updatePixels();
- break;
- case 157:
- break;
- default:
- opencv.read();
- opencv.restore(COLOR_SPACE);
- opencv.flip(OpenCV.FLIP_HORIZONTAL);
- bkgdImg = opencv.image();
- }
- }
- public void stop() {
- in.close();
- minim.stop();
- opencv.stop();
- super.stop();
- }
1