增加相机调试窗口、添加便于相机设置的接口等

master
bobpan 5 years ago
parent 7b041596f9
commit 9573e77c7f

@ -83,10 +83,10 @@ public:
{
m_lib.setFileName(ZString(szPath) + szLibName);
}
tpDebugOut("single paths: %s, name:%s", szPath, szLibName);
//tpDebugOut("single paths: %s, name:%s", szPath, szLibName);
m_fpInit = (Func_Lib_Init)m_lib.resolve(szFuncInit);
m_fpFree = (Func_Lib_Free)m_lib.resolve(szFuncFree);
tpDebugOut("init function, Name: %s, Address:%d", szFuncInit, (int)m_fpInit);
//tpDebugOut("init function, Name: %s, Address:%d", szFuncInit, (int)m_fpInit);
}
CDllLoaderM(const char *szLibName, const char *szFuncInit, const char *szFuncFree, const ZStringList& dllPaths) {
ZString szName(szLibName);
@ -100,13 +100,13 @@ public:
break;
}
}
tpDebugOut("Multi paths: %s, name:%s", szPath.toLocal8Bit().data(), szName.toLocal8Bit().data());
//tpDebugOut("Multi paths: %s, name:%s", szPath.toLocal8Bit().data(), szName.toLocal8Bit().data());
//
m_lib.setFileName(szPath + szName);
if (m_lib.load()) {
m_fpInit = (Func_Lib_Init)m_lib.resolve(szFuncInit);
m_fpFree = (Func_Lib_Free)m_lib.resolve(szFuncFree);
tpDebugOut("init function, Name: %s, Address:%d", szFuncInit, (int)m_fpInit);
//tpDebugOut("init function, Name: %s, Address:%d", szFuncInit, (int)m_fpInit);
}
else {
m_fpInit = NULL;

@ -16,6 +16,7 @@ public:
typedef std::function<QVariant(int)> FuncCallBack_VarInt;
typedef std::function<void(const QVariantMap&)> FuncCallBack_VarMap;
typedef std::function<void(const QString&, const QVariantMap&)> FuncCallBack_StrMap;
typedef std::function<void(const QString&, QImage)> FuncCallBack_StrImg;
//interface for gui
class ICoreCtrl
@ -47,6 +48,7 @@ public:
virtual bool IStopCamera(const QString& strSerial) = 0;
virtual bool IDeleteCamera(const QString& strSerial) = 0;
virtual bool IAddCamera(const QString& strName, const TP_CAMERA_OPTION& camOpt, bool bNew, bool bAutoRun = false) = 0;
virtual bool IRunAlg(const QString& strSerial, bool bRun) = 0;
//更新json配置文件
virtual bool updateCamJson(const QString& sJsonPath) = 0;
@ -54,7 +56,7 @@ public:
virtual bool ICamsPausePush() = 0;
virtual bool IRegisterGetVariant(FuncCallBack_VarInt callback) = 0; //向算法传递检测参数回调接口
virtual bool IRegisterImageCallBack(FuncCallBack_VarMap callback) = 0; //获取相机图像回调接口
virtual bool IRegisterImageCallBack(FuncCallBack_StrImg callback) = 0; //获取相机图像回调接口
virtual bool IRegisterResultCallBack(FuncCallBack_StrMap callback) = 0; //获取算法结果回调接口
public://private: //use private when the old main is discarded;

@ -4,11 +4,6 @@
#include "baseInclude.h"
#include "lpCameraImage.h"
// typedef struct tagCAMERA_IN_PARAM {
// class ICameraCallback* pCallback;
// }CAMERA_IN_PARAM;
class ICameraPool
{
public:
@ -38,7 +33,7 @@ public:
virtual int IOpenDevices(bool bReopenAll = true) = 0;
virtual int IOpenDevicesEx(bool bReopenAll = true) = 0; //如果camera.json里面配置了auto_open 值为false则调用该函数不会打开对应相机
virtual void ICloseDevices() = 0;
virtual bool IRunAlg(const QString& strSerial, bool bRun) = 0;
virtual void IStartDevices() = 0;
virtual void IStopDevices(const QString& sDef = NULL) = 0;
virtual void ISetTriggerMode(emTpDeviceTriggerMode mode, emTpTriggerDirection nDirection = TRIGGER_DIRECT_FOREWARD, long nFrameRate = 0) = 0;
@ -51,28 +46,12 @@ public:
//@camera: NULL means setting every camera
virtual void ISetCameraProperty(const QString& camera, emTpCameraProperty property, long nValue) = 0;
virtual void ISetCameraProperty(const QString& camera, TP_CAMERA_PROPERTY& property) = 0;
// virtual QList<TP_CAMERA_WIN*> ICameraWins() = 0;
virtual QMap<QString, QString> IGetCamShowNames() = 0;
virtual void ISetCameraEncode(INT64 code, INT64 rate) = 0;
virtual void ISetVirtualImages(const QString& camera, const QStringList& szImages) = 0;
//operate camera window
// virtual QList<QString> ICamWinKeys() = 0;
// virtual bool ICamWinOptionByKey(const QString& strKey, TP_CAMERA_WIN& camwinOpt) = 0;
// virtual bool IAddCamWin(const QString& strKey, const TP_CAMERA_WIN& camwinOpt, bool bNew) = 0;
// virtual bool IDelCamWin(const QString& strKey) = 0;
virtual bool ICamsStartPush() = 0;
virtual bool ICamsPausePush() = 0;
};
// class ICameraCallback
// {
// public:
// ICameraCallback() {}
// virtual ~ICameraCallback() {}
// virtual QVariant IGetVariantById(int nId) = 0;
// virtual void INewCameraImage(const QVariantMap& vmap) = 0;
// };
#endif

@ -193,6 +193,11 @@ void CCoreCtrl::ISetCameraProperty(const QString& camera, TP_CAMERA_PROPERTY& pr
return m_gpCameraPool->ISetCameraProperty(camera, property);
}
bool CCoreCtrl::IRunAlg(const QString& strSerial, bool bRun)
{
return m_gpCameraPool->IRunAlg(strSerial, bRun);
}
bool CCoreCtrl::updateCamJson(const QString& sJsonPath)
{
int nError;
@ -271,7 +276,7 @@ bool CCoreCtrl::IRegisterGetVariant(FuncCallBack_VarInt func)
return false;
}
bool CCoreCtrl::IRegisterImageCallBack(FuncCallBack_VarMap callback)
bool CCoreCtrl::IRegisterImageCallBack(FuncCallBack_StrImg callback)
{
if (callback)
{
@ -307,20 +312,7 @@ bool CCoreCtrl::onTaskFunc()
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__;
}
CImageObject m_objImage(this);
{
// Algorithm process image

@ -43,6 +43,7 @@ private:
virtual bool IStopCamera(const QString& strSerial) { return m_gpCameraPool->IStopCamera(strSerial); }
virtual bool IDeleteCamera(const QString& strSerial) { return m_gpCameraPool->IDeleteCamera(strSerial); }
virtual bool IAddCamera(const QString& strName, const TP_CAMERA_OPTION& camOpt, bool bNew, bool bAutoRun = false) { return m_gpCameraPool->IAddCamera(strName, camOpt, bNew, bAutoRun); }
virtual bool IRunAlg(const QString& strSerial, bool bRun);
//更新json配置文件
virtual bool updateCamJson(const QString& sJsonPath);
@ -52,12 +53,12 @@ private:
virtual bool ICamsPausePush() { return m_gpCameraPool->ICamsPausePush(); }
virtual bool IRegisterGetVariant(FuncCallBack_VarInt func);
virtual bool IRegisterImageCallBack(FuncCallBack_VarMap callback); //获取相机图像回调接口
virtual bool IRegisterImageCallBack(FuncCallBack_StrImg callback); //获取相机图像回调接口
virtual bool IRegisterResultCallBack(FuncCallBack_StrMap callback); //获取算法结果回调接口
bool onTaskFunc();
private:
QList<lpThread*> m_imgThdPool;
int m_nCoreCount;
int m_nCoreCount;
friend class CImageObject;
friend class QTpThreadImage;

@ -14,7 +14,7 @@ public:
public:
FuncCallBack_VarInt m_GetVariantCallBackFunc;//检测算法传输函数
FuncCallBack_StrMap m_ResultCallBackFunc;//检测结果回调函数
FuncCallBack_VarMap m_ImageCallBackFunc;//图像获取回调函数
FuncCallBack_StrImg m_ImageCallBackFunc;//图像获取回调函数
};
#endif

@ -22,16 +22,10 @@ lpCameraImage::~lpCameraImage()
int lpCameraImage::CopyCameraObject(ICameraObject* pCamObj)
{
// SetColorFormat(pCamObj->ColorFormat());
if (NULL == pCamObj || NULL == pCamObj->m_pCamOpt)
{
return -1;
}
// TP_CAMERA_OPTION* pOpt = pCamObj->CameraOption();
//if (NULL == pOpt)
//{
// return -1;
//}
if (NULL == m_pImage)
{
int nW = pCamObj->m_nImageWidth;
@ -47,12 +41,6 @@ int lpCameraImage::CopyCameraObject(ICameraObject* pCamObj)
}
m_nCopiedLines = 0;
copyOption(pCamObj);
//SetFrameNum(pCamObj->FrameNumber());
//SetTriggerCount(pCamObj->StartCount());
//SetSerial(pOpt->uniqueName.toUtf8().data());
//SetId(pOpt->id);
//SetAlgorithm(pOpt->algorithm);
//SetDllSuffix(pOpt->dllsuffix.toUtf8());
}
int nLines = m_pImage->height() - m_nCopiedLines;
if (nLines > pCamObj->m_nImageHeight)
@ -62,7 +50,6 @@ int lpCameraImage::CopyCameraObject(ICameraObject* pCamObj)
int nSizes = nLines * pCamObj->m_nImageWidth*((pCamObj->m_nBitsPerPixel + 7) / 8);
memcpy(m_pImage->scanLine(m_nCopiedLines), pCamObj->m_pCameraData, nSizes);
m_nCopiedLines += nLines;
//SetFileName(pCamObj->Utf8FileName());
if (m_nCopiedLines == m_pImage->height())
{
return 1;

@ -30,7 +30,9 @@ public:
emTpColorFormat ColorFormat() {
return m_colorFormat;
}
bool pushAlg() {
return bAutoPush;
}
long TriggerCount() {
return m_nTriggerCount;
}
@ -114,6 +116,7 @@ private:
INT64 m_nTimeStamp;
ZStringA m_dllSuffix;
QVariant m_varFromUI;
bool bAutoPush;
};
#endif // ZKCAMERAIMAGE_H

@ -155,18 +155,21 @@ bool CCameraPool::IAddCamera(const QString& strName, const TP_CAMERA_OPTION& cam
return bret;
}
bool CCameraPool::IRunAlg(const QString& strSerial, bool bRun)
{
ICameraObject* pCamera = m_cameraes.value(strSerial);
if (!pCamera)
return false;
pCamera->m_pCamOpt->bAutoPush = bRun;
return true;
}
bool CCameraPool::IStartCamera(const QString& strSerial)
{
ICameraObject* pCamera = m_cameraes.value(strSerial);
if (!pCamera)
return false;
//if (pCamera->m_pCamOpt->status != TP_CAMERA_STATUS_OPENED &&
// pCamera->m_pCamOpt->status != TP_CAMERA_STATUS_STOPPED )
//{
// return false;
//}
int nret = pCamera->IStartCamera();
if (nret == 1){
pCamera->m_pCamOpt->status = TP_CAMERA_STATUS_STARTED;
@ -641,7 +644,7 @@ void CCameraPool::cameraCalRelyOnEx(class ICameraObject*& pCam, void* pData)
}
}
}
//在主线程中运行?
int CCameraPool::IPushCameraData(ICameraObject* pCamObj)
{
if (m_imagesList.size() >= 32)
@ -667,7 +670,7 @@ int CCameraPool::IPushCameraData(ICameraObject* pCamObj)
return 0;
}
//
pCamObj->SaveToFile();
//pCamObj->SaveToFile();//保存图像
lpCameraImage *pImage = m_imagesMerging.value(pCamObj->m_pCamOpt->uniqueName, NULL);
if (NULL == pImage)
@ -678,42 +681,6 @@ int CCameraPool::IPushCameraData(ICameraObject* pCamObj)
if (NULL != pImage)
{
//
// if (!gpGlobalCamCallback){
// delete pImage;
// return 0;
// }
try{
if (lpCallBackFunc::instance()->m_GetVariantCallBackFunc)
{
QVariant val = lpCallBackFunc::instance()->m_GetVariantCallBackFunc(pCamObj->m_pCamOpt->id);
pImage->SetVarFromUI(val);
}
// else
// pImage->SetVarFromUI(gpGlobalCamCallback->IGetVariantById(pCamObj->m_pCamOpt->id));
//QVariantMap map;
//map.clear();
//map.insert("width", pCamObj->m_nImageWidth);
//map.insert("height", pCamObj->m_nImageHeight);
//map.insert("size", pCamObj->m_nImageSize);
//map.insert("frame", pCamObj->m_nFrameNum);
//qint64 nSizes = pCamObj->m_nImageHeight*pCamObj->m_nImageWidth*((pCamObj->m_nBitsPerPixel + 7) / 8);
////QByteArray baimgdat = QByteArray::fromRawData((const char*)(pCamObj->m_pCameraData), nSizes);
//QByteArray baimgdat = QByteArray((const char*)(pCamObj->m_pCameraData));
//map.insert("imgdata", baimgdat);
//std::string imgb64 = base64_encode(pCamObj->m_pCameraData, nSizes);
//int b64len = imgb64.length();
//QString qsimgb64(imgb64.c_str());
//map.insert("imgb64", qsimgb64);
//gpGlobalCamCallback->INewCameraImage(map);
}
catch (...){
qCritical() << "Critical error." << __FUNCTION__;
return 0;
}
//
int nRet = pImage->CopyCameraObject(pCamObj);
if (-1 == nRet)
{
@ -722,9 +689,36 @@ int CCameraPool::IPushCameraData(ICameraObject* pCamObj)
}
else if (1 == nRet)
{
pImage->SetMeterCode(m_nCameraEncode);
m_imagesList.append(pImage);
pImage = NULL;
if (pCamObj->m_pCamOpt->bAutoPush == false)
{
if (lpCallBackFunc::instance()->m_ImageCallBackFunc)
{
lpCallBackFunc::instance()->m_ImageCallBackFunc(pImage->Serial(), pImage->ToQImage());
}
delete pImage;
pImage = NULL;
}
else
{
try {
//获取算法参数 绑定到图像
if (lpCallBackFunc::instance()->m_GetVariantCallBackFunc)
{
QVariant val = lpCallBackFunc::instance()->m_GetVariantCallBackFunc(pCamObj->m_pCamOpt->id);
pImage->SetVarFromUI(val);
}
}
catch (...) {
qCritical() << "Critical error." << __FUNCTION__;
return 0;
}
pImage->SetMeterCode(m_nCameraEncode);
m_imagesList.append(pImage);
pImage = NULL;
}
}
m_imagesMerging.insert(pCamObj->m_pCamOpt->uniqueName, pImage);
nRet = 1;

@ -49,7 +49,7 @@ private:
virtual bool IStopCamera(const QString& strSerial);
virtual bool IDeleteCamera(const QString& strSerial);
virtual bool IAddCamera(const QString& strName, const TP_CAMERA_OPTION& camOpt, bool bNew, bool bAutoRun = false);
virtual bool IRunAlg(const QString& strSerial, bool bRun);
//
virtual int IOpenDevices(bool bReopenAll);
virtual int IOpenDevicesEx(bool bReopenAll);

@ -274,22 +274,24 @@ bool Station::trigImage()
bool b = m_pCoreCtrl->IStartCamera(szCamKey);
}
}
if (optCam.bAutoPush == true)
{
//filter
if (!m_pTrigDetector->filterTrig()) {
return false;
}
// check
if (!m_pTrigDetector->isWaitForTrig()) {
return false;
}
//filter
if (!m_pTrigDetector->filterTrig()) {
return false;
}
// check
if (!m_pTrigDetector->isWaitForTrig()) {
return false;
QString str = genTimerInfo();
//m_pTrigDetector->addTrigCount();
emit(sgaddTrigCount(1));
str += "trig succussful: " + QString::number(m_pTrigDetector->getTrigCount());
emit sgPrint2Window(str);
}
QString str = genTimerInfo();
//m_pTrigDetector->addTrigCount();
emit(sgaddTrigCount(1));
str += "trig succussful: " + QString::number(m_pTrigDetector->getTrigCount());
emit sgPrint2Window(str);
qDebug() << str;
QStringList strList = m_pCoreCtrl->ICameraKeys();
if (strList.contains(szCamKey))
{

@ -39,20 +39,20 @@ private:
private:
Ui::QCheckDataDlg ui;
QLabel *pShowName_label;
QLabel *check_showImg_label;
QTextBrowser *textBrowser;
StationDB *m_db;
QStandardItemModel *m_tableModel;
QTableView *tableView;
QDateTimeEdit *pStartTimeEdit;
QDateTimeEdit *pEndTimeEdit;
QLabel *pShowName_label{ nullptr };
QLabel *check_showImg_label{ nullptr };
QTextBrowser *textBrowser{ nullptr };
StationDB *m_db{ nullptr };
QStandardItemModel *m_tableModel{ nullptr };
QTableView *tableView{ nullptr };
QDateTimeEdit *pStartTimeEdit{ nullptr };
QDateTimeEdit *pEndTimeEdit{ nullptr };
QMap<QString, QString> m_strMap;
int nPrevNum;
int nTotlaNumber;
QTpGraphView *m_ViewImg;
QTpGraphView *m_ViewImg{ nullptr };
};
#endif // QCHECKDATADLG_H

@ -10,6 +10,7 @@
#include "Serialport_global.h"
#include <QProcess>
#include "lpSysConfig.h"
#include <QMenu>
#define LEAPER_LOGO ":/leaper/Resource/app.png"
#define DELETE_POINTER(p) if (p) {delete p; p = NULL;}
@ -122,6 +123,13 @@ CMainWin::CMainWin(QWidget *parent)
pDoc->setMaximumBlockCount(200);
pDoc = ui.wf_text_edit_result_2->document();
pDoc->setMaximumBlockCount(200);
ui.wf_lb_image_show_1->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui.wf_lb_image_show_1, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPopMenu(const QPoint&)));
connect(this, SIGNAL(sgShowSrcImg(QString, QImage)), &m_camSetWid, SLOT(onShowImage(QString, QImage)));
}
CMainWin::~CMainWin()
@ -164,6 +172,11 @@ CMainWin::~CMainWin()
rmTranslator();
lpSysLog::uninstance();
}
//相机原图接收回调 用于展示图像
void CMainWin::INewCameraImage(const QString& camKey, QImage img)
{
emit sgShowSrcImg(camKey, img);
}
void CMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
{
@ -724,6 +737,9 @@ bool CMainWin::onInitCoreCtrl()
FuncCallBack_StrMap strMapfunc = std::bind(&CMainWin::IVariantMapToUI, this, std::placeholders::_1,std::placeholders::_2);
m_pCoreCtrl->IRegisterResultCallBack(strMapfunc);
FuncCallBack_StrImg strImgfunc = std::bind(&CMainWin::INewCameraImage, this, std::placeholders::_1, std::placeholders::_2);
m_pCoreCtrl->IRegisterImageCallBack(strImgfunc);
}
m_pDllDetectorEngine->Initialize(m_pCoreCtrl);
@ -1001,3 +1017,46 @@ Q_SLOT void CMainWin::onShowLog(int nID, QString strMsg)
ui.wf_text_edit_result_2->append(strMsg);
}
}
Q_SLOT void CMainWin::onPopMenu(const QPoint& pt)
{
if (!m_pWfCtrl)
return;
/*根据UI名判断是哪个工位需要设置相机*/
int nStationID = 1;
QString strObj = sender()->objectName();
if ("wf_lb_image_show_1" == strObj)
nStationID = 1;
else if ("wf_lb_image_show_2" == strObj)
nStationID = 2;
IStation *pStation = m_pWfCtrl->IGetStationById(nStationID);
if (!pStation) {
//相机没配置,需要处理 添加相机
return;
}
QString strCamKey = pStation->stationKey();
QMenu menu;
QAction *pSetAction = menu.addAction(tr("相机属性配置"));
pSetAction->setObjectName("setAction");
QAction *pSelect = menu.exec(QCursor::pos());
if (!pSelect)
{
menu.clear();
return;
}
QString strObjAction = pSelect->objectName();
if (strObjAction == "setAction") {
m_camSetWid.setParent(this);
m_camSetWid.setWindowIcon(QIcon(LEAPER_LOGO));
m_camSetWid.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
m_camSetWid.setWindowModality(Qt::ApplicationModal);
m_camSetWid.setAttribute(Qt::WA_ShowModal, true);
m_camSetWid.setCamParam(m_pCoreCtrl, strCamKey);
m_camSetWid.show();
}
menu.clear();
}

@ -19,6 +19,7 @@
#include "QModelMangerUI.h"
#include "QAboutUI.h"
#include "QDeviceMgrUI.h"
#include "QCamSetDlg.h"
struct StationInfo
{
@ -26,7 +27,7 @@ struct StationInfo
bool m_bRunEnable{ false };
QString strModelName;
};
class CMainWin : public QMainWindow//, public IGuiCallback
class CMainWin : public QMainWindow
{
Q_OBJECT
@ -34,14 +35,18 @@ public:
CMainWin(QWidget *parent = Q_NULLPTR);
~CMainWin();
virtual void INewCameraImage(const QVariantMap& vMap) {};
virtual void IVariantMapToUI(const QString& camKey, const QVariantMap& vMap);
virtual QVariant IGetVariantById(int id);
//接收图像回调函数
void INewCameraImage(const QString& camKey, QImage img);
//接收算法检测结果回调函数
void IVariantMapToUI(const QString& camKey, const QVariantMap& vMap);
//传输算法参数回调函数
QVariant IGetVariantById(int id);
public:
Q_SLOT void onAppanalysis(SComFrame frame);
void onHeartComm(SComFrame &frame);
Q_SLOT void onHeardBit();
Q_SLOT void onShowLog(int nID, QString strMsg);
Q_SLOT void onPopMenu(const QPoint& pt);
Q_SLOT void onActionClicked();
QString genSavePath(QString modelName, QImage &img);
QString genSaveSrcImgPath(QString modelName, QImage &img);
@ -59,6 +64,7 @@ signals:
void sgSendChangeUI(QString, QString);
void sgShowLog(int, QString);
void sgShowImg(int, QImage);
void sgShowSrcImg(QString strkey, QImage);
private://ÖÐÓ¢·­Òë
void SearchQmFile(const QString & strDir);
void SetTranslator(const QString strPath);
@ -119,6 +125,7 @@ private:
QModelMangerUI m_mangeWid;
QAboutUI m_aboutWid;
QDeviceMgrUI m_devMgrWid;
QCamSetDlg m_camSetWid;
QString m_strUserName;
QString m_strComName;

@ -0,0 +1,83 @@
#include "QCamSetDlg.h"
QCamSetDlg::QCamSetDlg(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
m_ViewImg = new QTpGraphView;
QGridLayout *pGrid = new QGridLayout(this);
pGrid->addWidget(m_ViewImg);
ui.m_ImageLabel->setLayout(pGrid);
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.pushButton_2, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.pushButton_3, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
}
QCamSetDlg::~QCamSetDlg()
{
if (m_ViewImg) {
delete m_ViewImg;
m_ViewImg = nullptr;
}
}
void QCamSetDlg::setCamParam(ICoreCtrl* ptr, QString strCamkey)
{
m_curCamKey = strCamkey;
m_pCorl = ptr;
TP_CAMERA_OPTION camOpt;
bool b = m_pCorl->ICameraOptionByKey(strCamkey,camOpt);
if (b == true)
{
ui.m_camSnlineEdit->setText(m_curCamKey);
ui.comboBox_2->setCurrentIndex(camOpt.deviceType);
ui.comboBox->setCurrentIndex(camOpt.format);
ui.lineEdit_2->setText(QString("%1").arg(camOpt.exposure));
ui.lineEdit_3->setText(QString("%1").arg(camOpt.gain));
}
}
void QCamSetDlg::onShowImage(QString strKey, QImage img)
{
if (this->isHidden())
return;
if (strKey != m_curCamKey)
return;
if (m_ViewImg)
{
m_ViewImg->setImg(QPixmap::fromImage(img));
}
}
Q_SLOT void QCamSetDlg::onButtonClicked()
{
QString strObj = sender()->objectName();
if ("pushButton" == strObj)//±£´æ
{
}
else if ("pushButton_2" == strObj)//´ò¿ª
{
// m_pCorl->IOpenCamera(m_curCamKey);
// m_pCorl->IStartCamera(m_curCamKey);
m_pCorl->IRunAlg(m_curCamKey, false);
// m_pCorl->ISnapImage(QStringList()<<m_curCamKey);
}
else if ("pushButton_3" == strObj)//Ó¦ÓÃ
{
int exposure = ui.lineEdit_2->text().toInt();
int gain = ui.lineEdit_3->text().toInt();
}
}
void QCamSetDlg::closeEvent(QCloseEvent *event)
{
if (m_pCorl)
{
m_pCorl->IRunAlg(m_curCamKey, true);
}
}

@ -0,0 +1,33 @@
#ifndef _H_QCAMSETDLG_H_
#define _H_QCAMSETDLG_H_
#include <QWidget>
#include "ui_QCamSetDlg.h"
#include "iCoreCtrl.h"
#include "cunstomgraphview.h"
#include <QCloseEvent>
class QCamSetDlg : public QWidget
{
Q_OBJECT
public:
QCamSetDlg(QWidget *parent = Q_NULLPTR);
~QCamSetDlg();
void setCamParam(ICoreCtrl* ptr, QString strCam);
Q_SLOT void onShowImage(QString strKey, QImage img);
Q_SLOT void onButtonClicked();
protected:
virtual void closeEvent(QCloseEvent *event);
private:
Ui::QCamSetDlg ui;
QTpGraphView *m_ViewImg{ nullptr };
QString m_curCamKey;
ICoreCtrl* m_pCorl{ nullptr };
};
#endif

@ -0,0 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QCamSetDlg</class>
<widget class="QWidget" name="QCamSetDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>841</width>
<height>484</height>
</rect>
</property>
<property name="windowTitle">
<string>相机设置</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="m_ImageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(191, 191, 191);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="QLineEdit" name="m_camSnlineEdit">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>增益值:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBox">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<item>
<property name="text">
<string>GRAY8</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QComboBox" name="comboBox_2">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<item>
<property name="text">
<string>Virtual(100)</string>
</property>
</item>
<item>
<property name="text">
<string>Gige(120)</string>
</property>
</item>
<item>
<property name="text">
<string>HIK(140)</string>
</property>
</item>
<item>
<property name="text">
<string>Baumer(160)</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>曝光值:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLineEdit" name="lineEdit_2">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_3">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>图像格式:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>相机类型:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QPushButton" name="pushButton_2">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>相机ID</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="pushButton_3">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>应用参数</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>保存</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

@ -139,6 +139,7 @@
<ClCompile Include="lpSysConfig.cpp" />
<ClCompile Include="QAboutUI.cpp" />
<ClCompile Include="QAddModeUI.cpp" />
<ClCompile Include="QCamSetDlg.cpp" />
<ClCompile Include="QDeviceMgrUI.cpp" />
<ClCompile Include="QModelMangerUI.cpp" />
<ClCompile Include="QPLCIndexUI.cpp" />
@ -155,12 +156,17 @@
<QtUic Include="CMainWin.ui" />
<QtUic Include="QAboutUI.ui" />
<QtUic Include="QAddModeUI.ui" />
<QtUic Include="QCamSetDlg.ui" />
<QtUic Include="QDeviceMgrUI.ui" />
<QtUic Include="QModelMangerUI.ui" />
<QtUic Include="QPLCIndexUI.ui" />
<QtUic Include="QTestModeWid.ui" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="QCamSetDlg.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSerialBus;$(QTDIR)\include\QtSerialPort;$(QTDIR)\include\QtSql;.\..\..\3part\SerialPortTool\include;.\..\..\src\lpMain;.\..\..\src\lpMain\algela;.\..\..\src\lpMain\QDiskCleanThread;.\..\..\src\lpMain\sqliteDB;.\..\..\src\lpMain\UI;.\..\..\3part\opencv3.4.1\include;.\..\..\3part\opencv3.4.1\include\opencv;.\..\..\3part\opencv3.4.1\include\opencv2;.\..\..\3part\libzkq\include;.\..\..\3part\lpSyslog\inc;.\..\..\3part\customgui\include;.\..\..\src\userCtrl;.\..\..\src\lpMain\CoreCtrl;.\..\..\3part\tadpole\include\tpBase</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSerialBus;$(QTDIR)\include\QtSerialPort;$(QTDIR)\include\QtSql;.\..\..\3part\SerialPortTool\include;.\..\..\src\lpMain;.\..\..\src\lpMain\algela;.\..\..\src\lpMain\QDiskCleanThread;.\..\..\src\lpMain\sqliteDB;.\..\..\src\lpMain\UI;.\..\..\3part\opencv3.4.1\include;.\..\..\3part\opencv3.4.1\include\opencv;.\..\..\3part\opencv3.4.1\include\opencv2;.\..\..\3part\libzkq\include;.\..\..\3part\lpSyslog\inc;.\..\..\3part\customgui\include;.\..\..\src\userCtrl;.\..\..\src\lpMain\CoreCtrl;.\..\..\src\lpBase</IncludePath>
</QtMoc>
<QtMoc Include="QDeviceMgrUI.h">
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSerialBus;$(QTDIR)\include\QtSerialPort;$(QTDIR)\include\QtSql;.\..\..\3part\SerialPortTool\include;.\..\..\src\lpMain;.\..\..\src\lpMain\algela;.\..\..\src\lpMain\QDiskCleanThread;.\..\..\src\lpMain\sqliteDB;.\..\..\src\lpMain\UI;.\..\..\3part\opencv3.4.1\include;.\..\..\3part\opencv3.4.1\include\opencv;.\..\..\3part\opencv3.4.1\include\opencv2;.\..\..\3part\libzkq\include;.\..\..\3part\lpSyslog\inc;.\..\..\3part\customgui\include;.\..\..\src\userCtrl;.\..\..\src\lpMain\CoreCtrl;.\..\..\src\lpBase</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtSerialBus;$(QTDIR)\include\QtSerialPort;$(QTDIR)\include\QtSql;.\..\..\3part\SerialPortTool\include;.\..\..\src\lpMain;.\..\..\src\lpMain\algela;.\..\..\src\lpMain\QDiskCleanThread;.\..\..\src\lpMain\sqliteDB;.\..\..\src\lpMain\UI;.\..\..\3part\opencv3.4.1\include;.\..\..\3part\opencv3.4.1\include\opencv;.\..\..\3part\opencv3.4.1\include\opencv2;.\..\..\3part\libzkq\include;.\..\..\3part\lpSyslog\inc;.\..\..\3part\customgui\include;.\..\..\src\userCtrl;.\..\..\src\lpMain\CoreCtrl;.\..\..\src\lpBase</IncludePath>

@ -133,6 +133,9 @@
<ClCompile Include="QDeviceMgrUI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="QCamSetDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="IMainWidget.h">
@ -216,6 +219,9 @@
<QtMoc Include="QDeviceMgrUI.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="QCamSetDlg.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="CMainWin.ui">
@ -239,6 +245,9 @@
<QtUic Include="QDeviceMgrUI.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="QCamSetDlg.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\lpMain\CoreCtrl\CDllCoreCtrl.h">

Loading…
Cancel
Save