mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 19:57:11 +02:00
Let's try getting the cam's fps.
This commit is contained in:
parent
2ad8585f26
commit
e98d1f9a92
2 changed files with 5 additions and 1 deletions
|
@ -78,7 +78,7 @@ void Webcam::setFrame(void* image) {
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _frameWidth = img->width, _frameHeight = img->height, 0, GL_BGR,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _frameWidth = img->width, _frameHeight = img->height, 0, GL_BGR,
|
||||||
GL_UNSIGNED_BYTE, img->imageData);
|
GL_UNSIGNED_BYTE, img->imageData);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
printLog("Capturing webcam at %dx%d.\n", _frameWidth, _frameHeight);
|
printLog("Capturing webcam at %dx%dx%d.\n", _frameWidth, _frameHeight, _grabber->getFramesPerSecond());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
glBindTexture(GL_TEXTURE_2D, _frameTextureID);
|
glBindTexture(GL_TEXTURE_2D, _frameTextureID);
|
||||||
|
@ -112,6 +112,7 @@ void FrameGrabber::grabFrame() {
|
||||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_WIDTH, IDEAL_FRAME_WIDTH);
|
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_WIDTH, IDEAL_FRAME_WIDTH);
|
||||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_HEIGHT, IDEAL_FRAME_HEIGHT);
|
cvSetCaptureProperty(_capture, CV_CAP_PROP_FRAME_HEIGHT, IDEAL_FRAME_HEIGHT);
|
||||||
cvSetCaptureProperty(_capture, CV_CAP_PROP_FPS, IDEAL_FPS);
|
cvSetCaptureProperty(_capture, CV_CAP_PROP_FPS, IDEAL_FPS);
|
||||||
|
_framesPerSecond = cvGetCaptureProperty(_capture, CV_CAP_PROP_FPS);
|
||||||
}
|
}
|
||||||
IplImage* image = cvQueryFrame(_capture);
|
IplImage* image = cvQueryFrame(_capture);
|
||||||
if (image == 0) {
|
if (image == 0) {
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
FrameGrabber() : _capture(0) { }
|
FrameGrabber() : _capture(0) { }
|
||||||
virtual ~FrameGrabber();
|
virtual ~FrameGrabber();
|
||||||
|
|
||||||
|
int getFramesPerSecond() const { return _framesPerSecond; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void grabFrame();
|
void grabFrame();
|
||||||
|
@ -63,6 +65,7 @@ public slots:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
CvCapture* _capture;
|
CvCapture* _capture;
|
||||||
|
int _framesPerSecond;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__Webcam__) */
|
#endif /* defined(__interface__Webcam__) */
|
||||||
|
|
Loading…
Reference in a new issue