Okay so this is what I want to do; I have some exported images that I want to display randomly. Clicking the mouse should "activate" a first random exported image, and then I just want it to expand until it is as big as the size of my screen. Then I want this Image to go away, and to be replaced by a new random image (that starts small again and then grows till it hits the size of the screen, and so on and on).
This may seem pretty easy but I don't think I have a clue of what I'm doing since I'm really a beginner at this.
So far...
ArrayList all;
void setup() { size(700, 700); all = new ArrayList(); }
for (int i=0;i<all.size();i++) { export b = (export) all.get(i); b.draw(); }
}
void mouseClicked() { addClassInstance(); }
And for the class:
class export { PImage eimage; float x, y; float i = 0; float w = 150; float h = 150;
void init() { imageMode(CENTER); int number = int(random(1, 499)); eimage = loadImage("export-"+number+".png"); x = width/2; y = height/2; }
void draw() { image(eimage, x, y, w + i, h + i); i ++;
if(w + i > width + 100){ w = 0; h = 0; }
} }
So what this does (sort of): it adds a new random image when you click, but I don't know how to make it go away when it its width equals the windows width, since I'm pretty confused using the class and everything. Well, using Processing, generally.
The
if(w + i > width + 100){ w = 0; h = 0; }
, of course, is not working, the image resets to size 0, 0 but then just grows again.
this might be hard to understand what I'm trying to say, but.
I have a slider which gives me values from 0 tot 1020. When the slider is left it's 0, completely right it's 1020 obviously. Now I want to be able to change my background simultaneously. So, when the slider value is 0, I want my background to have an opacity/alpha value of 0, and when the slider is right I want my background to be fully visible. The same for the values in between.
Oh yes, and I forget to ask. Is there an equivalent for the rectMode(CENTER) for images, so that I can rotate an image around it's own origin?
I've been trying to create a very simple code and loaded a font in it, but I don't know how to smooth it. I did use the "smooth" option and put "smooth();" in my void setup. I guess I'm making some dumb mistake again but I don't know how to fix this.
Second thing, I'd like my strokeWeight to increase by 1 everytime a new line is drawn. I don't really know how to do this either. Using ++ I guess, but how do I link this to the new line being draw every time?
Third problem, actually, when I try to paste my code here the entire markup is gone.
- never mind about that, using a different browser works fine.
Hi all! Since I'm having no luck with my previous
topic on eye tracking, I thought I could maybe get some help on this.
I'm a beginner at Processing and working with OpenCV to recognize a face in this case via webcam, and when it sees a face, it draws a rectangle on this face.
Now instead of that, I want an image to be displayed on the face (it doesn't need to be automatically scaled or something, just to be placed on top of the face is all I'm trying to do for now). I have no idea how to do that though, I only know how to import an image, that's all.
This is my code. Sorry for using a link by the way, but when I paste something in here, it loses all its markup.
Hi all. I'm completely new to Processing, but I need to make the following: I want Processing (or better said, OpenCV) to import video from the webcam input, then recognize the eyes of a face (and after that, I want an image to be placed over the eyes, but that's for later).
So, I tried downloading OpenCV, which came with some examples, of which I thought the "Face Recognition" example was the closest to what I want.
This is what I have now (pretty much just the code from the example). The face recognition works fine.
Now, I also found
this topic, saying there already is a pre-made cascade to recognize eyes, which could be found
here. So I downloaded the "frontalEyes35x16XML.zip" file, unzipped it and place it on the Resources folder of my OpenCV (as told in the topic). However, I'm stuck from that point. I can't figure out how to switch from the face recognition cascade to the eye recognition cascade. I'm also not sure if I still need something to properly install it (edit the OpenCV.java file?).
Anyone who could help me with this (probably simple to solve) problem?
I'm totally new to Processing and currently trying to rotate a triangle around its own axis without success. The rotation radius is way too big, apparently this has something to do with the translate but I have no idea how to do this.
The this is the part of the code:
pushMatrix();
translate(width/2,height/2);
rotate(s*radians(90));
triangle(70, 235, 128, 150, 186, 235);
popMatrix();
The "s" refers to seconds, which I defined earlier in the code, so the triangle would turn around it's own axis every time a second passes (it's a clock sort of thing).