public long millis() { return intf.app.millis(); }
public void forceUpdate(Camera camera, int time) { int id = getId(camera); nextTimeEvent.set(id, applet.millis() + time); updateStatus.set(id, FORCE_UPDATE); }
public void blockUpdate(Camera camera, int time) { int id = getId(camera); nextTimeEvent.set(id, applet.millis() + time); updateStatus.set(id, BLOCK_UPDATE); }
public synchronized void updateLocation(Camera camera, IplImage img, Object globalTracking) { int id = getId(camera); if (id == -1) { throw new RuntimeException("The board " + this.fileName + " is" + " not registered with the camera you asked"); } int currentTime = applet.millis(); int endTime = nextTimeEvent.get(id); int mode = updateStatus.get(id); // If the update is still blocked if (mode == BLOCK_UPDATE && currentTime < endTime) { return; } updatePositionImpl(id, currentTime, endTime, mode, camera, img, globalTracking); }
@Override public void prepare(Supervisor supervisor) { shader.set("time", sketch.millis() / 1000f); shader.set("amount", amount); shader.set("speed", speed); }
public void draw(float x, float y) { String visible = text.substring(pos0, text.length()); parent.text(visible, x, y); if (focused) { // Draw blinking cursor. int t = parent.intf.app.millis(); if (500 < t - lastCursorChange) { if (cursorStatus == CURSOR_VISIBLE) { cursorStatus = CURSOR_HIDDEN; } else { cursorStatus = CURSOR_VISIBLE; } lastCursorChange = t; } if (cursorStatus == CURSOR_VISIBLE) { int curPos = pos - pos0; String substr = visible.substring(0, curPos); float len = parent.textWidth(substr); parent.line(x + len, y, x + len, y - parent.fontSize()); } } }
public void setFocused(boolean focus) { if (focus != focused) { boolean focused0 = focused; focused = focus; if (focused) { cursorStatus = CURSOR_VISIBLE; lastCursorChange = parent.intf.app.millis(); if (!focused0 && clearInitial && getImpl(false).equals(text0)) { set(""); } } else if (resetInitial) { String last = getImpl(false); if (last.equals("")) { set(text0); modified = false; } } } }
lastPos.set(id, currentPos); updateStatus.set(id, FORCE_UPDATE); nextTimeEvent.set(id, applet.millis() + MarkerBoard.updateTime);
nextTimeEvent.set(id, applet.millis() + MarkerBoard.updateTime);
private TrackedDepthPoint createTouchPointFrom(TuioObject tObj) { TrackedDepthPoint tp = new TrackedDepthPoint(); tp.setCreationTime(parent.millis()); tp.forceID(tObj.getSymbolID()); return tp; }
protected void findAndTrack2D() { assert (touch2DPrecision != 0); ArrayList<TrackedDepthPoint> newList = simpleDetection.compute( depthAnalysis.getDepthData()); TouchPointTracker.trackPoints(simpleDetection.getTouchPoints(), newList, parent.millis()); }
protected void findAndTrack3D() { assert (touch3DPrecision != 0); ArrayList<TrackedDepthPoint> newList = armDetection.compute( depthAnalysis.getDepthData()); TouchPointTracker.trackPoints(armDetection.getTouchPoints(), newList, parent.millis()); }
private TrackedDepthPoint createTouchPointFrom(TuioCursor tcur) { TrackedDepthPoint tp = new TrackedDepthPoint(); tp.setCreationTime(parent.millis()); tp.forceID(tcur.getCursorID()); return tp; }
/** * Update the current Image, from the specific grabber, lens distorsions are * handled here. * * @param img */ protected void updateCurrentImage(IplImage img) { this.timeStamp = parent.millis(); if (undistort) { if (pdp == null || !pdp.handleDistorsions()) { System.err.println("I cannot distort the image for processing. The " + "calibration did not contain information. "); return; } if (copyUndist == null) { copyUndist = img.clone(); } // Workaround for crash when the java program is closing // to avoid native code to continue to run... if (isClosing()) { return; } pdp.getDevice().undistort(img, copyUndist); currentImage = copyUndist; } else { currentImage = img; } }
lastPos.set(id, currentPos); updateStatus.set(id, FORCE_UPDATE); nextTimeEvent.set(id, applet.millis() + MarkerBoard.updateTime);
public static void sin(PApplet parent, PGraphics g, int amt, float freq, int xDiff, float size) { float v = (PApplet.sin((float) (parent.millis()) / 1000f * PConstants.TWO_PI * freq) + 1f) / 2f; g.noStroke(); g.ellipseMode(CENTER); g.fill(v * amt); g.ellipse(-xDiff, 0, size, size); g.ellipse(0, 0, size, size); g.ellipse(xDiff, 0, size, size); }
/** * Simple visualization * * @param depth * @param color * @param skip * @return */ public PImage update(IplImage depth, IplImage color, int skip) { updateRawDepth(depth); if (color != null) { updateRawColor(color); } depthData.clear(); depthData.timeStamp = papplet.millis(); validPointsPImage.loadPixels(); // set a default color. Arrays.fill(validPointsPImage.pixels, papplet.color(0, 0, 0)); // TODO: get the color with Kinect2... if (this.colorCamera.getPixelFormat() == Camera.PixelFormat.RGB) { computeDepthAndDo(skip, new SetImageDataRGB()); } if (this.colorCamera.getPixelFormat() == Camera.PixelFormat.BGR) { computeDepthAndDo(skip, new SetImageData()); } validPointsPImage.updatePixels(); return validPointsPImage; }
public void computeDepthAndNormals(opencv_core.IplImage depth, opencv_core.IplImage color, int skip2D) { updateRawDepth(depth); // optimisation no Color. if (color != null) { updateRawColor(color); } depthData.clear(); depthData.timeStamp = papplet.millis(); depthData.connexity.setPrecision(skip2D); computeDepthAndDo(skip2D, new ComputeNormal()); if (this.colorCamera.getPixelFormat() == Camera.PixelFormat.GRAY) { doForEachPoint(skip2D, new SetImageDataGRAY()); } if (this.colorCamera.getPixelFormat() == Camera.PixelFormat.RGB) { doForEachPoint(skip2D, new SetImageDataRGB()); } if (this.colorCamera.getPixelFormat() == Camera.PixelFormat.BGR) { doForEachPoint(skip2D, new SetImageData()); } // doForEachPoint(skip2D, new ComputeNormal()); }