How to Control the CameraFPS using a regular webcam

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mmh771
Posts: 39
Joined: Thu Apr 27, 2006 7:02 am

How to Control the CameraFPS using a regular webcam

Post by mmh771 »

Dear all,
I hope you will be able to read this ASAP, because i am really running out of time and i have a graduation project to deliver after 4 days! ....

Once i post a thread about, "How to Control the CameraFPS using a regular webcam!" and someone post me a helpful response that i am thankful about, but it doesn't work just exactly what i am looking for!

Again, my project is basically about getting a snapshot from the webcam every 0.1 second, and then analyze this image using matlab to determine which is greater, the blue value in the Image or red value! ...

and stores the result in a text file as a percentage(eg. if the Red value would be 70, then the blue would be 30), that is readable in the irrlicht code.

So ... if the red Value is higher than the blue's the camera would look at right.

And if the Blue is the Higher one, the camera would turn left.

now lets say the webcam took a snap shot and that the red value was the higher value, the webcam would turn right, AND if the webcam took a second snapshot and still the red value is Higher the blue, i will turn right Again, and it will keep in turning right until the webcam takes a snapshot with a Blue Value higher than the red's

The only 2 variables i get from the matlab is:
float red;
float blue;

you post this:

Code: Select all

ICameraSceneNode *camera;
camera = smgr->addCameraSceneNodeFPS (0, 100, 500);
camera->setInputReceiverEnabled (false);

then:
camera->setPosition (irr::core::vector3df (posx, posy, posz));
camera->setRotation (irr::core::vector3df (rotx, roty,rotz)); 
Code you help me in solving this problem!
stef_
Posts: 53
Joined: Tue Apr 18, 2006 9:39 pm
Contact:

Post by stef_ »

What does it mean ?
> but it doesn't work just exactly what i am looking for!

while (running) {
....
// set roty accordingly to your algorithm
....
// then apply it
camera->setRotation (irr::core::vector3df (0, roty,0));
...
}

bye
mmh771
Posts: 39
Joined: Thu Apr 27, 2006 7:02 am

Post by mmh771 »

I mean the code i've posted just turn the face one time, it doesn't keep in turning right!
stef_
Posts: 53
Joined: Tue Apr 18, 2006 9:39 pm
Contact:

Post by stef_ »

It's an absolute value, NOT relative.

camera->setRotation (irr::core::vector3df (0, 90,0));
camera->setRotation (irr::core::vector3df (0, 95,0)); >>> rotate 5 degrees
camera->setRotation (irr::core::vector3df (0, 100,0)); >>> rotate again 5 degrees

bye
vegeta
Posts: 12
Joined: Fri May 12, 2006 4:56 pm
Location: the netherlands

Post by vegeta »

use a loop
Post Reply