Implement Void PlaYUVerFrame::copyFrom( cv::Mat* opencvFrame )
This commit is contained in:
1 parent
92e758009d
commit
cb3a120a0b
2 files changed
+47
-1
No files matched your search
@@ -520,10 +520,55 @@ cv::Mat PlaYUVerFrame::getCvMat()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy( opencvFrame.data, &(m_pppcInputPel[LUMA][0][0]), getBytesPerFrame() * sizeof(Pel) );
|
memcpy( opencvFrame.data, &( m_pppcInputPel[LUMA][0][0] ), getBytesPerFrame() * sizeof(Pel) );
|
||||||
}
|
}
|
||||||
return opencvFrame;
|
return opencvFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Void PlaYUVerFrame::copyFrom( cv::Mat* opencvFrame )
|
||||||
|
{
|
||||||
|
if( m_iPixelFormat == NO_FMT )
|
||||||
|
{
|
||||||
|
switch( opencvFrame->channels() )
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
m_iPixelFormat = GRAY;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
m_iPixelFormat = RGB8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !isValid() )
|
||||||
|
{
|
||||||
|
init( opencvFrame->cols, opencvFrame->rows, m_iPixelFormat );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bHasRGBPel = false;
|
||||||
|
|
||||||
|
if( m_iPixelFormat != GRAY )
|
||||||
|
{
|
||||||
|
Pel* pInputPelY = m_pppcInputPel[LUMA][0];
|
||||||
|
Pel* pInputPelU = m_pppcInputPel[CHROMA_U][0];
|
||||||
|
Pel* pInputPelV = m_pppcInputPel[CHROMA_V][0];
|
||||||
|
Pel* pcRGBPelInterlaced = m_pcRGBPelInterlaced;
|
||||||
|
memcpy( pcRGBPelInterlaced, opencvFrame->data, getBytesPerFrame() * sizeof(Pel) );
|
||||||
|
for( UInt i = 0; i < m_uiHeight * m_uiWidth; i++ )
|
||||||
|
{
|
||||||
|
*pInputPelY++ = *pcRGBPelInterlaced++;
|
||||||
|
*pInputPelU++ = *pcRGBPelInterlaced++;
|
||||||
|
*pInputPelV++ = *pcRGBPelInterlaced++;
|
||||||
|
}
|
||||||
|
m_bHasRGBPel = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy( m_pppcInputPel[LUMA][0], opencvFrame->data, getBytesPerFrame() * sizeof(Pel) );
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// NAMESPACE
|
// NAMESPACE
|
||||||
@@ -145,6 +145,7 @@ public:
|
|||||||
|
|
||||||
#ifdef USE_OPENCV
|
#ifdef USE_OPENCV
|
||||||
cv::Mat getCvMat();
|
cv::Mat getCvMat();
|
||||||
|
Void copyFrom( cv::Mat* input_frame );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt getWidth() const
|
UInt getWidth() const
|
||||||
|
|||||||
Reference in new issue
Block a user