Hi, so im looking to change the saturation of the “coral” im my code. I have the image connected to open CV so it tracks your face. Im wanting to have the colour of the coral be in greyscale when the tracking image is in the middle of the screen, but then the coral will turn colourful when the tracked image gets close to it. Im not sure on how to do this since im kind of new to processing.
This is the a screen shot of my code and what it would look like. The seahorse is the tracked image and the coral is on the left and right.
Here is the code im working with. If you have any idea on how to implement my idea that be amazing !
import gab.opencv.*;
import processing.video.*;
import java.awt.*;
PImage img;
PImage background;
PImage imgCoral;
color colCoral;
Capture video;
OpenCV opencv;
void setup() {
size(1920, 1080);
colorMode (HSB);
img = loadImage("photo1.png");
imgCoral = loadImage ("coral.png");
background=loadImage ("sea.png");
video = new Capture(this, 640, 480);
opencv = new OpenCV(this, 640, 480);
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
video.start();
}
void draw() {
background (background);
image(imgCoral,0,0);
scale(2);
opencv.loadImage(video);
noFill();
stroke(0, 0, 0);
strokeWeight(3);
Rectangle[] faces = opencv.detect();
println(faces.length);
for (int i = 0; i < faces.length; i++) {
println(faces[i].x + "," + faces[i].y);
image(img, faces[i].x, faces[i].y, faces[i].width,faces[i].height);
}
}
void captureEvent(Capture c) {
c.read();
}