Page 1 of 1

How to Control the CameraFPS using a regular webcam

Posted: Thu May 25, 2006 7:30 am
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!

Posted: Thu May 25, 2006 8:43 am
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

Posted: Thu May 25, 2006 10:19 am
by mmh771
I mean the code i've posted just turn the face one time, it doesn't keep in turning right!

Posted: Thu May 25, 2006 11:14 am
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

Posted: Fri May 26, 2006 6:04 am
by vegeta
use a loop