The program’s result is like following.import SimpleOpenNI.*; SimpleOpenNI context; color[] userColors = { color(255,0,0), color(0,255,0), color(0,0,255), color(255,255,0), color(255, 0, 255), color(0, 255, 255) }; void setup() { context = new SimpleOpenNI(this); context.setMirror(false); context.enableDepth(); context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL); size(context.depthWidth(), context.depthHeight()); } void draw() { context.update(); image(context.depthImage(), 0, 0); int[] userMap = null; int userCount = context.getNumberOfUsers(); if (userCount > 0) { userMap = context.getUsersPixels(SimpleOpenNI.USERS_ALL); } loadPixels(); for (int y=0; y<context.depthHeight(); y++) { for (int x=0; x<context.depthWidth(); x++) { int index = x + y * context.depthWidth(); if (userMap != null && userMap[index] > 0) { int colorIndex = userMap[index] % userColors.length; pixels[index] = userColors[colorIndex]; } } } updatePixels(); }
Streamlit is a …
I bought M5Stac…