Flipping Webcam Explanation Please!!
in
Core Library Questions
•
7 months ago
Hello.
I read a few posts but do not quite understand why and how the copied sketch works.
Alternatively, line 15 and 16 could be written with the following three lines. This further confuses me.
scale(-1, 1);
translate(-camera.width, 0);
image(camera, 0, 0);
Shouldn't the -1 of scale() and -width of image() or -camera.width of translate() make the width positive!?
If so, why would it actually flip the webcam?
Would anyone be kind enough to explain or direct me to a resource?
Thank you.
- import processing.video.*;
- Capture camera;
- void setup() {
- size(640, 480);
- camera = new Capture(this, width, height);
- camera.start();
- }
- void draw() {
- if (camera.available()) {
- camera.read();
- }
- scale(-1, 1);
- image(camera, 0, 0, -width, height);
- }
1