Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
Switching over frame extraction to Bayer color conversion to match ne…
Browse files Browse the repository at this point in the history
…w PS3EYEDriver output
  • Loading branch information
HipsterSloth committed Jul 3, 2016
1 parent 05e5efb commit a588126
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/psmoveservice/PSMoveTracker/PSEye/PSEyeVideoCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class PSEYECaptureCAM_PS3EYE : public cv::IVideoCapture
public:
PSEYECaptureCAM_PS3EYE(int _index)
: m_index(-1), m_width(-1), m_height(-1), m_widthStep(-1),
m_size(-1), m_MatYUV(0, 0, CV_8UC2)
m_size(-1), m_MatBayer(0, 0, CV_8UC1)
{
//CoInitialize(NULL);
open(_index);
Expand Down Expand Up @@ -357,8 +357,9 @@ class PSEYECaptureCAM_PS3EYE : public cv::IVideoCapture

if (new_pixels != NULL)
{
std::memcpy(m_MatYUV.data, new_pixels, m_MatYUV.total() * m_MatYUV.elemSize() * sizeof(uchar));
cv::cvtColor(m_MatYUV, outArray, CV_YUV2BGR_YUY2);
std::memcpy(m_MatBayer.data, new_pixels, m_MatBayer.total() * m_MatBayer.elemSize() * sizeof(uchar));
//cv::cvtColor(m_MatYUV, outArray, CV_YUV2BGR_YUY2);
cv::cvtColor(m_MatBayer, outArray, CV_BayerGB2BGR);
free(new_pixels);
return true;
}
Expand Down Expand Up @@ -430,15 +431,15 @@ class PSEYECaptureCAM_PS3EYE : public cv::IVideoCapture
void refreshDimensions()
{
m_width = eye->getWidth();
m_widthStep = eye->getRowBytes(); // just width * 2.
m_widthStep = eye->getRowBytes(); // just width * 1 byte per pixel.
m_height = eye->getHeight();
m_size = m_widthStep * m_height;
m_MatYUV.create(cv::Size(m_width, m_height), CV_8UC2);
m_MatBayer.create(cv::Size(m_width, m_height), CV_8UC1);
}

int m_index, m_width, m_height, m_widthStep;
size_t m_size;
cv::Mat m_MatYUV;
cv::Mat m_MatBayer;
ps3eye::PS3EYECam::PS3EYERef eye;
};

Expand Down

0 comments on commit a588126

Please sign in to comment.