Change functions related with PlaYUVerFrame and QImage
This commit is contained in:
1 parent
4560b4e2d8
commit
0d6aa2b5bc
5 files changed
+38
-28
No files matched your search
+6
-24
@@ -243,33 +243,10 @@ Void InputStream::readFrame()
|
||||
|
||||
Bool InputStream::writeFrame( const QString& filename )
|
||||
{
|
||||
QImage img( m_uiWidth, m_uiHeight, QImage::Format_RGB888 );
|
||||
getFrame( &img );
|
||||
img.save( filename );
|
||||
m_cCurrFrame->getQimage().save( filename );
|
||||
return true;
|
||||
}
|
||||
|
||||
QImage* InputStream::getFrame( QImage *qimage )
|
||||
{
|
||||
Pel*** bufferRGB = m_cCurrFrame->getPelBufferRGB();
|
||||
|
||||
if( sizeof(Pel) == sizeof(unsigned char) )
|
||||
{
|
||||
for( Int y = 0; y < m_uiHeight; y++ )
|
||||
{
|
||||
for( Int x = 0; x < m_uiWidth; x++ )
|
||||
{
|
||||
qimage->setPixel( x, y, qRgb( bufferRGB[0][y][x], bufferRGB[1][y][x], bufferRGB[2][y][x] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT( 0 );
|
||||
}
|
||||
return qimage;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* InputStream::getFrame( PlaYUVerFrame *pyuv_image )
|
||||
{
|
||||
Pel*** bufferRGB = m_cCurrFrame->getPelBufferRGB();
|
||||
@@ -281,6 +258,11 @@ PlaYUVerFrame* InputStream::getFrame( PlaYUVerFrame *pyuv_image )
|
||||
return pyuv_image;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* InputStream::getFrame()
|
||||
{
|
||||
return m_cCurrFrame;
|
||||
}
|
||||
|
||||
#ifdef USE_OPENCV
|
||||
cv::Mat InputStream::getFrameCvMat()
|
||||
{
|
||||
|
||||
@@ -103,8 +103,8 @@ public:
|
||||
|
||||
Bool writeFrame( const QString& filename );
|
||||
|
||||
QImage* getFrame( QImage *qimage );
|
||||
PlaYUVerFrame* getFrame( PlaYUVerFrame *qimage );
|
||||
PlaYUVerFrame* getFrame();
|
||||
PlaYUVerFrame* getFrame( PlaYUVerFrame * );
|
||||
#ifdef USE_OPENCV
|
||||
cv::Mat getFrameCvMat();
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "LibMemAlloc.h"
|
||||
|
||||
#include <QImage>
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
@@ -207,6 +209,28 @@ Void PlaYUVerFrame::CopyFrom( PlaYUVerFrame* input_frame )
|
||||
}
|
||||
}
|
||||
|
||||
QImage PlaYUVerFrame::getQimage()
|
||||
{
|
||||
QImage img( m_uiWidth, m_uiHeight, QImage::Format_RGB888 );
|
||||
Pel*** bufferRGB = getPelBufferRGB();
|
||||
|
||||
if( sizeof(Pel) == sizeof(unsigned char) )
|
||||
{
|
||||
for( Int y = 0; y < m_uiHeight; y++ )
|
||||
{
|
||||
for( Int x = 0; x < m_uiWidth; x++ )
|
||||
{
|
||||
img.setPixel( x, y, qRgb( bufferRGB[0][y][x], bufferRGB[1][y][x], bufferRGB[2][y][x] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT( 0 );
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
UInt64 PlaYUVerFrame::getBytesPerFrame()
|
||||
{
|
||||
switch( m_iPixelFormat )
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "TypeDef.h"
|
||||
|
||||
class QImage;
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
@@ -59,6 +61,8 @@ public:
|
||||
{
|
||||
return m_pppcRGBPel;
|
||||
}
|
||||
QImage getQimage();
|
||||
|
||||
UInt getWidth()
|
||||
{
|
||||
return m_uiWidth;
|
||||
|
||||
@@ -121,7 +121,7 @@ Void SubWindowHandle::enableModule( PlaYUVerModuleIf* select_module )
|
||||
return;
|
||||
}
|
||||
m_pcCurrentModule = select_module;
|
||||
m_pcCurrentModule->create( m_pCurrStream->getFrame( m_pcCurrentModule->getModImage() ) );
|
||||
m_pcCurrentModule->create( m_pCurrStream->getFrame() );
|
||||
refreshFrame();
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ Void SubWindowHandle::refreshFrame()
|
||||
{
|
||||
if( m_pcCurrentModule )
|
||||
{
|
||||
FrameToQImage( m_pcCurrentModule->process( m_pCurrStream->getFrame( m_pcCurrentModule->getModImage() ) ) );
|
||||
FrameToQImage( m_pcCurrentModule->process( m_pCurrStream->getFrame() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user