I’ll throw in only the important parts, but for an image processing application I’m making, I want to analyze the image with the rgb components (typical picture), and then change it to black and white using the threshold filter, and run a few things with black and white. It all happens when I click the mouse, but I can’t seem to get the color photo back. Ideally it would happen in mouseReleased, and I’d run the majority of the code in mousePressed. Let me know with any thoughts, thanks.
PImage crossSection;
void setup() {
size(1008, 756);
crossSection = loadImage("crossSection.jpg");
}
void draw() {
backgound(0);
image(crossSection, 0, 0);
crossSection.resize(1008, 756);
loadPixels();
crossSection.loadPixels();
updatePixels();
}
void mousePressed() {
//code that needs an RGB photo
crossSection.filter(THRESHOLD, .85);
updatePixels();
//code that needs the black and white version
}
void mouseReleased() {
//not sure what to put here in order to change the image back to RGB
}
a temporary loading from mousePressed() might be overwritten by next draw.
so better use the mouse to change the threshold value only ( used in draw later )
OR
move the image(); up into the setup(); could work too.