How to debug "ArrayIndexOutOfBoundsException: 0" in Processing -
i'm trying make kim asendorf's pixel sorting code work input webcam in processing.
i error: "arrayindexoutofboundsexception: 0". ideas of how can fix this?
//black int getfirstnotblacky(int _x, int _y) { int x = _x; int y = _y; color c; if (y < height) { while ( (c = cam.pixels[x + y * cam.width]) < blackvalue) { y++; if (y >= height) return -1; } import processing.video.*; capture cam; string[] cameras = capture.list(); int mode = 0; //mode: //0 -> black //1 -> bright //2 -> white //b(16777216) int loops = 1; int blackvalue = -10000000; int brigthnessvalue = 60; int whitevalue = -6000000; int row = 0; int column = boolean saved = false; void setup() { size(640, 480); import processing.video.*; string[] cameras = capture.list(); import processing.video.*; if (cameras.length == 0) { println("there no cameras available capture."); exit(); } else { println("available cameras:"); (int = 0; < cameras.length; i++) { println(cameras[i]); } // camera can initialized directly using // element array returned list(): cam = new capture(this, cameras[0]); cam.start(); } }
i've added code i'm using initialize webcam.
Comments
Post a Comment