From 80e029ae1336dbb4e977d227aa1c6210b5a9cb0b Mon Sep 17 00:00:00 2001 From: gb2111 Date: Fri, 11 Nov 2016 16:10:32 +0100 Subject: [PATCH] make camera flip image instead of code to save some cpu on my tests with delay_thread=0 to see higher utilisation I went down from 53 to 48 % of cpu utilisation on 4eye3controler setup --- src/psmoveservice/Device/View/ServerTrackerView.cpp | 3 +-- src/psmoveservice/PSMoveTracker/PSEye/PSEyeVideoCapture.cpp | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/psmoveservice/Device/View/ServerTrackerView.cpp b/src/psmoveservice/Device/View/ServerTrackerView.cpp index 93c29db5..ae1f8de6 100644 --- a/src/psmoveservice/Device/View/ServerTrackerView.cpp +++ b/src/psmoveservice/Device/View/ServerTrackerView.cpp @@ -381,8 +381,7 @@ class OpenCVBufferState { const cv::Mat videoBufferMat(frameHeight, frameWidth, CV_8UC3, const_cast(video_buffer)); - // Copy and Flip image about the x-axis - cv::flip(videoBufferMat, *bgrBuffer, 1); + videoBufferMat.copyTo(*bgrBuffer); // Convert the video buffer to the HSV color space if (bgr2hsv != nullptr) diff --git a/src/psmoveservice/PSMoveTracker/PSEye/PSEyeVideoCapture.cpp b/src/psmoveservice/PSMoveTracker/PSEye/PSEyeVideoCapture.cpp index 24bf53fe..b0b8cb06 100644 --- a/src/psmoveservice/PSMoveTracker/PSEye/PSEyeVideoCapture.cpp +++ b/src/psmoveservice/PSMoveTracker/PSEye/PSEyeVideoCapture.cpp @@ -405,6 +405,8 @@ class PSEYECaptureCAM_PS3EYE : public cv::IVideoCapture eye->setAutogain(false); eye->setAutoWhiteBalance(false); + + eye->setFlip(true, false); m_index = _index; refreshDimensions();