Mirroring a webcam in a sketch
in
Core Library Questions
•
2 years ago
We have a few sketches where we want to mirror the webcam - but we are using blend within the sketch, and any mirroring:
// flip image horizonatlly
pushMatrix();
scale(-1,1);
popMatrix();
Doesn't work when we are using blend() to manipulate the live feed - any ideas?
I looked at using an .java file for the capture (from you einstein sketch) - could I run the mirror function in mycapture.java, and if so how?
This is from the gwoptics file which I wish to adapt:
import processing.core.PImage;
import processing.core.PApplet;
import processing.core.PConstants;
import processing.video.*;
public class mycapture {
private Capture cam;
private int _w;
private int _h;
private PImage _img;
public mycapture (PApplet pa, int w, int h) {
_w=w;
_h=h;
cam=new Capture(pa,_w,_h);
}
public PImage get_image(){
cam.read();
PImage tmp=cam.get();
//tmp.filter(PApplet.GRAY);
return tmp;
}
public void stop() {
cam.stop();
}
}
1