Implement the function cv::Mat PlaYUVerFrame::getCvMat()

This commit is contained in:
jfmcarreira committed 2014-05-17 02:07:25 +01:00
1 parent 6967077204
commit 92e758009d
3 files changed
+35 -13

No files matched your search

-9
View File
@@ -387,15 +387,6 @@ PlaYUVerFrame* InputStream::getCurrFrame()
return m_pcCurrFrame;
}
#ifdef USE_OPENCV
cv::Mat InputStream::getFrameCvMat()
{
cv::Mat cvMat( m_uiHeight, m_uiWidth, CV_8UC3 );
return cvMat;
}
#endif
Void InputStream::seekInput( UInt64 new_frame_num )
{
if( !m_pFile )
+32 -4
View File
@@ -37,8 +37,8 @@ PlaYUVerFrame::PlaYUVerFrame( UInt width, UInt height, Int pel_format )
PlaYUVerFrame::PlaYUVerFrame( PlaYUVerFrame *other )
{
init( other->getWidth(), other->getHeight(), other->getPelFormat() );
copyFrom(other);
init( other->getWidth(), other->getHeight(), other->getPelFormat() );
copyFrom( other );
}
PlaYUVerFrame::~PlaYUVerFrame()
@@ -494,8 +494,36 @@ Pixel PlaYUVerFrame::getPixelValue( const QPoint &pos, Int color_space )
#ifdef USE_OPENCV
cv::Mat PlaYUVerFrame::getCvMat()
{
return cv::Mat();
Int cvType = CV_8UC3;
switch( m_iPixelFormat )
{
case YUV420p:
case YUV444p:
case YUV422p:
case YUYV422:
cvType = CV_8UC3;
break;
case GRAY:
cvType = CV_8UC1;
break;
case RGB8:
cvType = CV_8UC3;
break;
default:
break;
}
cv::Mat opencvFrame( m_uiHeight, m_uiWidth, cvType );
if( m_iPixelFormat != GRAY )
{
FrametoRGB8();
memcpy( opencvFrame.data, m_pcRGBPelInterlaced, getBytesPerFrame() * sizeof(Pel) );
}
else
{
memcpy( opencvFrame.data, &(m_pppcInputPel[LUMA][0][0]), getBytesPerFrame() * sizeof(Pel) );
}
return opencvFrame;
}
#endif
}
// NAMESPACE
// NAMESPACE
+3
View File
@@ -31,6 +31,9 @@
#include <cstdio>
#include <cassert>
#include <QtCore>
#ifdef USE_OPENCV
#include <opencv2/opencv.hpp>
#endif
#ifdef USE_PIXFC
#include "pixfc-sse.h"
#endif