@@ -0,0 +1,2354 @@
+package com.haxademic.demo.hardware.webcam;%0A%0Aimport com.haxademic.core.app.PAppletHax;%0Aimport com.haxademic.core.app.config.AppSettings;%0Aimport com.haxademic.core.app.config.Config;%0Aimport com.haxademic.core.data.constants.PRenderers;%0Aimport com.haxademic.core.debug.DebugView;%0Aimport com.haxademic.core.draw.context.PG;%0Aimport com.haxademic.core.draw.filters.pshader.ColorizeFromTexture;%0Aimport com.haxademic.core.draw.filters.pshader.RotateFilter;%0Aimport com.haxademic.core.draw.image.ImageUtil;%0Aimport com.haxademic.core.hardware.mouse.Mouse;%0Aimport com.haxademic.core.hardware.webcam.WebCam;%0Aimport com.haxademic.core.hardware.webcam.WebCam.IWebCamCallback;%0Aimport com.haxademic.core.media.video.MovieBuffer;%0A%0Aimport processing.core.PGraphics;%0Aimport processing.core.PImage;%0A%0Apublic class Demo_WebcamColorizeFromVideo%0Aextends PAppletHax%0Aimplements IWebCamCallback %7B%0A%09public static void main(String args%5B%5D) %7B arguments = args; PAppletHax.main(Thread.currentThread().getStackTrace()%5B1%5D.getClassName()); %7D%0A%0A%09protected PGraphics flippedCamera;%0A%09protected MovieBuffer movie;%0A%0A%09protected void config() %7B%0A%09%09Config.setProperty(AppSettings.WIDTH, 1280 );%0A%09%09Config.setProperty(AppSettings.HEIGHT, 720 );%0A%09%09Config.setProperty(AppSettings.SHOW_DEBUG, true );%0A%09%7D%0A%0A%09protected void firstFrame () %7B%0A%09%09// load movie%0A%09%09movie = new MovieBuffer(%22C:%5C%5CUsers%5C%5Ccacheflowe%5C%5CDownloads%5C%5C210720_GRADIENT_B_raster.mp4%22);%0A%09%09movie.movie.speed(3);%0A%09%09movie.movie.loop();%0A%09%09%0A%09%09// capture webcam frames%0A%09%09WebCam.instance().setDelegate(this);%0A%09%7D%0A%0A%09@Override%0A%09public void newFrame(PImage frame) %7B%0A%09%09// lazy-init flipped camera buffer%0A%09%09if(flippedCamera == null) flippedCamera = p.createGraphics(800, 600, PRenderers.P2D);%0A%09%09ImageUtil.copyImageFlipH(frame, flippedCamera);%0A%09%09DebugView.setTexture(%22webcam%22, flippedCamera);%0A%09%7D%0A%0A%09protected void drawApp() %7B%0A%09%09// set up context%0A%09%09p.background( 0 );%0A%09%09PG.setDrawCenter(p);%0A%09%09PG.setCenterScreen(p);%0A%0A%09%09// show camera & colorize%0A%09%09if(flippedCamera != null && movie.buffer != null) %7B%0A%09%09%09DebugView.setTexture(%22movie.buffer%22, movie.buffer);%0A%0A%09%09%09ImageUtil.cropFillCopyImage(flippedCamera, p.g, true);%0A%09%09%09ColorizeFromTexture.instance(p).setTexture(movie.buffer);%0A%09%09%09ColorizeFromTexture.instance(p).setLumaMult(Mouse.xNorm %3E 0.5f);%0A%09%09%09ColorizeFromTexture.instance(p).setCrossfade(Mouse.yNorm);%0A%09%09%09ColorizeFromTexture.instance(p).applyTo(p);%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Create Demo_WebcamColorizeFromVideo.java