You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
#include "qtpthreadimage.h"
|
|
#include "globalCoreCtrl.h"
|
|
#include "CoreCtrl.h"
|
|
#include <QDebug>
|
|
|
|
QTpThreadImage::QTpThreadImage(class CCoreCtrl* pCtrl, class IDetectorEngine* pDE /*= NULL*/,QObject *parent /* = NULL */)
|
|
: QTpThreadBase(parent)
|
|
, m_pCoreCtrl(pCtrl)
|
|
, m_objImage(pCtrl)
|
|
, m_pDE(pDE)
|
|
{
|
|
|
|
}
|
|
|
|
QTpThreadImage::~QTpThreadImage()
|
|
{
|
|
LOG_SPIDER::FreeLog();
|
|
}
|
|
|
|
bool QTpThreadImage::loop()
|
|
{
|
|
QTime timespan;
|
|
|
|
timespan.start();
|
|
CZkCameraImage* pCamImage = m_pCoreCtrl->m_gpCameraPool->IPopCameraImage();
|
|
int span = timespan.elapsed();
|
|
if (span > 100)
|
|
{
|
|
qWarning() << "Pop image from poll cost " << span << " MSecs"
|
|
<< " - " __FUNCTION__;
|
|
}
|
|
|
|
if( NULL != pCamImage )
|
|
{
|
|
{
|
|
// send image to UI
|
|
timespan.restart();
|
|
//TODO show Image
|
|
// m_pCoreCtrl->ShowCameraImage(pCamImage->Serial()
|
|
// , pCamImage->FrameNumber()
|
|
// , pCamImage->ToQImage()
|
|
// , pCamImage->Stamp()
|
|
// , 0
|
|
// , QString::fromUtf8(pCamImage->FileName()));//(pCamImage);
|
|
//
|
|
// qDebug() << "Show camera image to UI cost " << timespan.elapsed() << " MSecs"
|
|
// << " - " __FUNCTION__;
|
|
}
|
|
|
|
{
|
|
// Algorithm process image
|
|
timespan.restart();
|
|
m_objImage.SetCameraImage(pCamImage);
|
|
m_pCoreCtrl->m_gpImgProc->IImageProcess(&m_objImage, m_pDE);
|
|
qDebug() << "Process Image(ID:" << pCamImage->FrameNumber()
|
|
<< ") cost " << timespan.elapsed() << " MSecs"
|
|
<< " - " __FUNCTION__;
|
|
}
|
|
//release CameraImage
|
|
m_objImage.SetCameraImage(NULL);
|
|
m_pCoreCtrl->m_gpCameraPool->IFreeCameraImage(pCamImage);
|
|
}
|
|
else
|
|
{
|
|
QTpThreadBase::loop();
|
|
}
|
|
|
|
return true;
|
|
} |