Convert webcam image to gray
in
Core Library Questions
•
1 year ago
Hi all,
I want to have the image of my webcam displayed on the screen, but just in grayscale with no colours.
I tried doing it this way:
- myCapture.filter(GRAY);
- image(myCapture, 0, 0);
So do you have any ideas how to solve this?
When using the OpenCV library they have a function like this
- opencv.convert(OpenCV.GRAY);
But the convert does not work without the CV library. So, I'm glad for any suggestions.
Just as an additional information: I'm using the webcam thing on fullscreen, so probably this makes some trouble?
So below you'll find the whole code:
- import processing.video.*;
- Capture myCapture;
- void setup()
- {
- size(1920, 1200);
- myCapture = new Capture(this, width, height, 30);
- }
- void captureEvent(Capture myCapture) {
- myCapture.read();
- }
- void draw() {
- myCapture.filter(GRAY);
- image(myCapture, 0, 0);
- }
1