mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 17:53:32 +02:00
Reset webcam along with other sensors on spacebar, added settings config for
non-Apple.
This commit is contained in:
parent
6493f3aa44
commit
b14a0c1554
3 changed files with 22 additions and 0 deletions
|
@ -2525,6 +2525,7 @@ void Application::resetSensors() {
|
|||
if (_serialHeadSensor.active) {
|
||||
_serialHeadSensor.resetAverages();
|
||||
}
|
||||
_webcam.reset();
|
||||
QCursor::setPos(_headMouseX, _headMouseY);
|
||||
_myAvatar.reset();
|
||||
_myTransmitter.resetLevels();
|
||||
|
|
|
@ -41,6 +41,7 @@ void Webcam::setEnabled(bool enabled) {
|
|||
_frameCount = 0;
|
||||
|
||||
// let the grabber know we're ready for the first frame
|
||||
QMetaObject::invokeMethod(_grabber, "reset");
|
||||
QMetaObject::invokeMethod(_grabber, "grabFrame");
|
||||
|
||||
} else {
|
||||
|
@ -48,6 +49,13 @@ void Webcam::setEnabled(bool enabled) {
|
|||
}
|
||||
}
|
||||
|
||||
void Webcam::reset() {
|
||||
if (_enabled) {
|
||||
// send a message to the grabber
|
||||
QMetaObject::invokeMethod(_grabber, "reset");
|
||||
}
|
||||
}
|
||||
|
||||
void Webcam::renderPreview(int screenWidth, int screenHeight) {
|
||||
if (_enabled && _frameTextureID != 0) {
|
||||
glBindTexture(GL_TEXTURE_2D, _frameTextureID);
|
||||
|
@ -142,6 +150,10 @@ FrameGrabber::~FrameGrabber() {
|
|||
}
|
||||
}
|
||||
|
||||
void FrameGrabber::reset() {
|
||||
_searchWindow = Rect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void FrameGrabber::grabFrame() {
|
||||
if (_capture == 0) {
|
||||
if ((_capture = cvCaptureFromCAM(-1)) == 0) {
|
||||
|
@ -155,6 +167,13 @@ void FrameGrabber::grabFrame() {
|
|||
|
||||
#ifdef __APPLE__
|
||||
configureCamera(0x5ac, 0x8510, false, 0.99, 0.5, 0.5, 0.5, true, 0.5);
|
||||
#else
|
||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_EXPOSURE, 0.5);
|
||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_CONTRAST, 0.5);
|
||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_SATURATION, 0.5);
|
||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_BRIGHTNESS, 0.5);
|
||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_HUE, 0.5);
|
||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_GAIN, 0.5);
|
||||
#endif
|
||||
|
||||
switchToResourcesParentIfRequired();
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
Webcam();
|
||||
~Webcam();
|
||||
|
||||
void reset();
|
||||
void renderPreview(int screenWidth, int screenHeight);
|
||||
|
||||
public slots:
|
||||
|
@ -65,6 +66,7 @@ public:
|
|||
|
||||
public slots:
|
||||
|
||||
void reset();
|
||||
void grabFrame();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue