From 4e540816b8bfdbefa0d10d82451dc0250880e111 Mon Sep 17 00:00:00 2001 From: "bob.pan" Date: Tue, 17 Aug 2021 09:43:25 +0800 Subject: [PATCH] add cam code --- 3part/tadpole/include/tpBase/baseStruct.h | 2 +- src/lpCamera/lpCamHik/CameraHik.cpp | 482 ++++++++++ src/lpCamera/lpCamHik/CameraHik.h | 43 + src/lpCamera/lpCamHik/tpCamHik.cpp | 14 + .../lpCamVirtual/CameraVirtualFolder.cpp | 244 +++++ .../lpCamVirtual/CameraVirtualFolder.h | 41 + src/lpCamera/lpCamVirtual/tpCamVirtual.cpp | 18 + src/lpCamera/tpCamBaumer/CameraBaumer.cpp | 832 ++++++++++++++++++ src/lpCamera/tpCamBaumer/CameraBaumer.h | 66 ++ src/lpCamera/tpCamBaumer/tpCamBaumer.cpp | 15 + src/lpCamera/tpCamGige/CameraGige.cpp | 351 ++++++++ src/lpCamera/tpCamGige/CameraGige.h | 58 ++ src/lpCamera/tpCamGige/tpCamGige.cpp | 43 + tpvs17/tpCamVirtual/tpCamVirtual.vcxproj | 6 +- .../tpCamVirtual/tpCamVirtual.vcxproj.filters | 10 +- tpvs17/wheel.sln | 12 +- 16 files changed, 2227 insertions(+), 10 deletions(-) create mode 100644 src/lpCamera/lpCamHik/CameraHik.cpp create mode 100644 src/lpCamera/lpCamHik/CameraHik.h create mode 100644 src/lpCamera/lpCamHik/tpCamHik.cpp create mode 100644 src/lpCamera/lpCamVirtual/CameraVirtualFolder.cpp create mode 100644 src/lpCamera/lpCamVirtual/CameraVirtualFolder.h create mode 100644 src/lpCamera/lpCamVirtual/tpCamVirtual.cpp create mode 100644 src/lpCamera/tpCamBaumer/CameraBaumer.cpp create mode 100644 src/lpCamera/tpCamBaumer/CameraBaumer.h create mode 100644 src/lpCamera/tpCamBaumer/tpCamBaumer.cpp create mode 100644 src/lpCamera/tpCamGige/CameraGige.cpp create mode 100644 src/lpCamera/tpCamGige/CameraGige.h create mode 100644 src/lpCamera/tpCamGige/tpCamGige.cpp diff --git a/3part/tadpole/include/tpBase/baseStruct.h b/3part/tadpole/include/tpBase/baseStruct.h index 9c3c12f..f3fb58b 100644 --- a/3part/tadpole/include/tpBase/baseStruct.h +++ b/3part/tadpole/include/tpBase/baseStruct.h @@ -186,7 +186,7 @@ namespace TP_FUNCS { return TP_COLOR_RGB24; } - else if (QImage::Format_Indexed8 == image.format()) + else if (QImage::Format_Indexed8 == image.format()||QImage::Format_Grayscale8 == image.format()) { return TP_COLOR_Y800; } diff --git a/src/lpCamera/lpCamHik/CameraHik.cpp b/src/lpCamera/lpCamHik/CameraHik.cpp new file mode 100644 index 0000000..d8ae845 --- /dev/null +++ b/src/lpCamera/lpCamHik/CameraHik.cpp @@ -0,0 +1,482 @@ +#include +#include +#include "CameraHik.h" +#include "MvCameraControl.h" + + +void _stdcall ImageCallBack(unsigned char* pData, MV_FRAME_OUT_INFO* pFrameInfo, void* pUser) +{ + if (pUser == NULL || + pData == NULL || + pFrameInfo == NULL) + { + return; + } + + CCameraHik* pCamHik = static_cast(pUser); + if (pCamHik) + { + pCamHik->OnImageCallBack(pData, pFrameInfo); + } +} + + +CCameraHik::CCameraHik(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) + : ICameraObject(pCamOpt, pCb) + , m_pCb(pCb) + , m_hDevice(NULL) + , m_width(0) + , m_height(0) +{ + +} + +CCameraHik::~CCameraHik() +{ + ICloseCamera(); +} + +int CCameraHik::IOpenCamera() +{ + if (NULL == m_pCamOpt) return 0; + if (m_bOpened) return 1; + + QString uniqueName = m_pCamOpt->uniqueName; + QStringList modelAndSerial = uniqueName.split(' ', QString::SkipEmptyParts); + if (modelAndSerial.size() < 2) + { + qWarning() << "Not valid camera key:" << m_pCamOpt->uniqueName << TP_LOG_TAIL; + return 0; + } + + MV_CC_DEVICE_INFO_LIST stDevList; + memset(&stDevList, 0, sizeof(MV_CC_DEVICE_INFO_LIST)); + int nRet = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &stDevList); + if (MV_OK != nRet) + { + qWarning() << "Failed to EnumDevices." << TP_LOG_TAIL; + return 0; + } + + nRet = MV_OK; + for (UINT i = 0; i < stDevList.nDeviceNum; ++i) + { + if (modelAndSerial[0] == (char*)(stDevList.pDeviceInfo[i]->SpecialInfo.stGigEInfo.chModelName) && + modelAndSerial[1] == (char*)(stDevList.pDeviceInfo[i]->SpecialInfo.stGigEInfo.chSerialNumber)) + { + qDebug() << "Found camera " << m_pCamOpt->uniqueName << TP_LOG_TAIL; + nRet = MV_CC_CreateHandle(&m_hDevice, stDevList.pDeviceInfo[i]); + if (MV_OK != nRet) + { + qWarning() << "Failed to CreateHandle." << TP_LOG_TAIL; + return 0; + } + + nRet = MV_CC_OpenDevice(m_hDevice); + if (MV_OK != nRet) + { + qWarning() << "Failed to OpenDevice." << TP_LOG_TAIL; + MV_CC_DestroyHandle(&m_hDevice); + return 0; + } + + nRet = MV_CC_RegisterImageCallBack(m_hDevice, ImageCallBack, this); + if (MV_OK != nRet) + { + qWarning() << "Failed to RegisterImageCallBack." << TP_LOG_TAIL; + MV_CC_DestroyHandle(&m_hDevice); + return 0; + } + + break; + } + } + + if (!GetParameters()){ + qWarning() << "Failed to get camera parameters." << TP_LOG_TAIL; + MV_CC_DestroyHandle(&m_hDevice); + return 0; + } + + m_nFrameNum = 0; + m_bOpened = true; + m_bStarted = false; + + qDebug() << "Successfully open camera: " << m_pCamOpt->uniqueName + << " - " << __FUNCTION__; + return 1; +} + +void CCameraHik::InitProperty() +{ + //初始化图像高度 + //初始化图像宽度 + if (m_hDevice != nullptr&&m_pCamOpt != nullptr) + { + int nRet = 0; +// nRet = MV_CC_SetWidth(m_hDevice, m_pCamOpt->width); +// nRet = MV_CC_SetHeight(m_hDevice, m_pCamOpt->height); + nRet = MV_CC_SetExposureTime(m_hDevice, m_pCamOpt->exposure); + nRet = MV_CC_SetGain(m_hDevice, m_pCamOpt->gain); + //nRet = MV_CC_SetPixelFormat(m_hDevice, PixelType_Gvsp_Mono8); + } +} + +QList CCameraHik::IEnumAvailableCameras() +{ + QList ret; + + MV_CC_DEVICE_INFO_LIST stDevList; + memset(&stDevList, 0, sizeof(MV_CC_DEVICE_INFO_LIST)); + int nRet = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &stDevList); + if (MV_OK != nRet) + { + return ret; + } + + nRet = -1; + for (UINT i = 0; i < stDevList.nDeviceNum; ++i) + { + QString strKey = QString("%1 %2") + .arg((char*)(stDevList.pDeviceInfo[i]->SpecialInfo.stGigEInfo.chModelName)) + .arg((char*)(stDevList.pDeviceInfo[i]->SpecialInfo.stGigEInfo.chSerialNumber)); + + ret.append(strKey); + } + + return ret; +} + +void CCameraHik::ICloseCamera() +{ + if (!m_bOpened) return; + + if (!m_hDevice) return; + + IStopCamera(); + + + MV_CC_DestroyHandle(m_hDevice); + m_hDevice = NULL; + + m_bOpened = false; + m_bStarted = false; +} + +int CCameraHik::IStartCamera() +{ + if (!m_bOpened) return 0; + + if (!m_hDevice) return 0; + + int nRet = MV_OK; + + if (m_oldTriggerMode != m_newTriggerMode) { + switch (m_newTriggerMode) { + case DEV_TRIGGER_MODE_OUT: + { + //设置触发模式为on + unsigned int nValue = MV_TRIGGER_SOURCE_LINE0; + nRet = MV_CC_SetEnumValue(m_hDevice, "TriggerSource", nValue); + if (MV_OK != nRet){ + qWarning() << QString("Error: TriggerSource to line0 failed [%1]").arg(nRet) + << " - " << __FUNCTION__; + return 0; + } + + nValue = MV_TRIGGER_MODE_ON; + nRet = MV_CC_SetEnumValue(m_hDevice, "TriggerMode", nValue); + if (MV_OK != nRet){ + qWarning() << QString("Error: SetTriggerMode to on failed [%1]").arg(nRet) + << " - " << __FUNCTION__; + return 0; + } + break; + } + case DEV_TRIGGER_MODE_AUTO: + case DEV_TRIGGER_MODE_FIXED_AUTO: + { + //设置触发模式为off + unsigned int nValue = MV_TRIGGER_MODE_OFF; + nRet = MV_CC_SetEnumValue(m_hDevice, "TriggerMode", nValue); + if (MV_OK != nRet){ + qWarning() << QString("Error: SetTriggerMode to off failed [%1]").arg(nRet) + << " - " << __FUNCTION__; + return 0; + } + break; + } + default: + break; + } + m_oldTriggerMode = m_newTriggerMode; + } + + if (!m_bStarted){ + nRet = MV_CC_StartGrabbing(m_hDevice); + if (MV_OK != nRet){ + qWarning() << QString("Error: StartGrabbing failed [%1]").arg(nRet) + << " - " << __FUNCTION__; + return 0; + } + + m_bStarted = true; + } + return 1; +} + +void CCameraHik::IStopCamera() +{ + if (!m_bOpened) return; + + if (!m_bStarted) return; + + if (!m_hDevice) return; + + int nRet = MV_OK; + nRet = MV_CC_StopGrabbing(m_hDevice); + if (MV_OK != nRet) + { + qWarning() << QString("Error: StopGrabbing failed [%1]").arg(nRet) + << " - " << __FUNCTION__; + return; + } + + m_bStarted = false; +} + +void CCameraHik::ISnapCamera() +{ + if (!m_hDevice) + return ; + + int nRet = MV_OK; + if (m_oldTriggerMode != DEV_TRIGGER_MODE_SOFT) { + unsigned int nValue = MV_TRIGGER_SOURCE_SOFTWARE; + nRet = MV_CC_SetEnumValue(m_hDevice, "TriggerSource", nValue); + if (MV_OK != nRet){ + qWarning() << QString("Error: TriggerSource to line0 failed [%1]").arg(nRet) + << " - " << __FUNCTION__; + return ; + } + nValue = MV_TRIGGER_MODE_ON; + nRet = MV_CC_SetEnumValue(m_hDevice, "TriggerMode", nValue); + if (MV_OK != nRet){ + qWarning() << QString("Error: SetTriggerMode to on failed [%1]").arg(nRet) + << " - " << __FUNCTION__; + return ; + } + + m_oldTriggerMode = DEV_TRIGGER_MODE_SOFT; + } + + nRet = MV_CC_SetCommandValue(m_hDevice, "TriggerSoftware"); + if (MV_OK != nRet) { + qWarning() << "Failed to set triggerSoftware - " << __FUNCTION__; + return ; + } + + return ; +} + +int CCameraHik::GetParameters() +{ + if (m_hDevice == NULL) + { + return 0; + } + + MVCC_INTVALUE intValue = { 0 }; + int nRst = MV_CC_GetWidth(m_hDevice, &intValue); + if (nRst != MV_OK) + { + return 0; + } + + m_nImageWidth = intValue.nCurValue; + + memset(&intValue, 0, sizeof(MVCC_INTVALUE)); + nRst = MV_CC_GetHeight(m_hDevice, &intValue); + if (nRst != MV_OK) + { + return 0; + } + + m_nImageHeight = intValue.nCurValue; + + MVCC_ENUMVALUE enumValue = { 0 }; + nRst = MV_CC_GetPixelFormat(m_hDevice, &enumValue); + if (nRst != MV_OK) + { + return 0; + } + + m_pixFormat = enumValue.nCurValue; + + return 1; +} + +void CCameraHik::OnImageCallBack(unsigned char* pData, MV_FRAME_OUT_INFO* pFrameInfo) +{ + qWarning() << "Hikvision Camera image get:" << QString::number(QDateTime::currentMSecsSinceEpoch()) << endl; + + if (pData == NULL || + pFrameInfo == NULL) + { + return; + } + + //m_nFrameNum = pFrameInfo->nFrameNum + 1; + ++m_nFrameNum; + m_pCameraData = (BYTE*)pData; + m_nImageWidth = pFrameInfo->nWidth; + m_nImageHeight = pFrameInfo->nHeight; + //m_nBitsPerPixel = (pFrameInfo->nFrameLen / (m_nImageWidth * m_nImageHeight)) * 8; + SetColorFormat(pFrameInfo->enPixelType); + m_pCb->IPushCameraData(this); +} + +void CCameraHik::SetColorFormat(MvGvspPixelType pixType) +{ + if (pixType == PixelType_Gvsp_RGBA8_Packed) + { + m_nColorFormat = TP_COLOR_RGB32; + m_nBitsPerPixel = 32; + } + else if (pixType == PixelType_Gvsp_RGB8_Packed) + { + m_nColorFormat = TP_COLOR_RGB24; + m_nBitsPerPixel = 24; + } + else if (pixType == PixelType_Gvsp_Mono8) + { + m_nColorFormat = TP_COLOR_Y800; + m_nBitsPerPixel = 8; + } + else if (pixType == PixelType_Gvsp_RGB16_Packed) + { + m_nColorFormat = TP_COLOR_Y16; + m_nBitsPerPixel = 16; + } + else + { + m_nColorFormat = TP_COLOR_Y800; + m_nBitsPerPixel = 8; + } +} + +bool CCameraHik::ISetProperty(TP_CAMERA_PROPERTY* pCamProperty) +{ + if (!pCamProperty) + return false; + + int nRet; + + if (pCamProperty->property == TP_CAM_PROPERTY_EXPOSURE) + { + //设置【自动曝光模式】为off + unsigned int nValue = MV_EXPOSURE_AUTO_MODE_OFF; //关闭 + nRet = MV_CC_SetExposureAutoMode(m_hDevice, nValue); + if (MV_OK != nRet){ + qWarning() << "Failed to SetExposureAutoMode" << TP_LOG_TAIL; + //return false; + } + + //获取相机曝光值 + MVCC_FLOATVALUE struFloatValue = { 0 }; + nRet = MV_CC_GetExposureTime(m_hDevice, &struFloatValue); + if (MV_OK != nRet){ + qWarning() << "Failed to GetExposureTime" << TP_LOG_TAIL; + return false; + } + + //检查设置值是否合理 + if (pCamProperty->value < struFloatValue.fMin || pCamProperty->value > struFloatValue.fMax){ + qWarning() << QString("Invalid exposure time value:%1.").arg(pCamProperty->value) + << " - " << __FUNCTION__; + return false; + } + + //设置设备增益 + float fValue = pCamProperty->value; + nRet = MV_CC_SetExposureTime(m_hDevice, fValue); + if (MV_OK != nRet){ + qWarning() << "Failed to SetExposureTime" << TP_LOG_TAIL; + return false; + } + + qDebug() << QString("Set exposure time value:%1 successfully.").arg(pCamProperty->value) + << TP_LOG_TAIL; + + } + + if ((TP_CAM_PROPERTY_BALANCE_RATIO_RED == pCamProperty->property) || + (TP_CAM_PROPERTY_BALANCE_RATIO_GREEN == pCamProperty->property) || + (TP_CAM_PROPERTY_BALANCE_RATIO_BLUE == pCamProperty->property)) + { + // 关闭自动白平衡 + unsigned int nValue = MV_BALANCEWHITE_AUTO_OFF; //关闭 + nRet = MV_CC_SetBalanceWhiteAuto(m_hDevice, nValue); + if (MV_OK != nRet){ + qWarning() << "Failed to SetBalanceWhiteAuto to OFF" << TP_LOG_TAIL; + return false; + } + + //设置白平衡 + nValue = pCamProperty->value; + switch (pCamProperty->property){ + case TP_CAM_PROPERTY_BALANCE_RATIO_RED: + nRet = MV_CC_SetBalanceRatioRed(m_hDevice, nValue); + break; + case TP_CAM_PROPERTY_BALANCE_RATIO_GREEN: + nRet = MV_CC_SetBalanceRatioGreen(m_hDevice, nValue); + break; + case TP_CAM_PROPERTY_BALANCE_RATIO_BLUE: + nRet = MV_CC_SetBalanceRatioBlue(m_hDevice, nValue); + break; + } + + if (MV_OK != nRet){ + qWarning() << "Failed to SetBalanceRatio to " << nValue << TP_LOG_TAIL; + return false; + } + + qDebug() << "Successfully SetBalanceRatio to " << nValue << TP_LOG_TAIL; + } + if (TP_CAM_PROPERTY_GAIN == pCamProperty->property) { + //设置【自动曝光模式】为off + unsigned int nValue = MV_EXPOSURE_AUTO_MODE_OFF; //关闭 + nRet = MV_CC_SetExposureAutoMode(m_hDevice, nValue); + if (MV_OK != nRet) { + qWarning() << "Failed to SetExposureAutoMode" << TP_LOG_TAIL; + //return false; + } + + //获取相机曝光值 + MVCC_FLOATVALUE struFloatValue = { 0 }; + nRet = MV_CC_GetGain(m_hDevice, &struFloatValue); + if (MV_OK != nRet) { + qWarning() << "Failed to GetExposureTime" << TP_LOG_TAIL; + return false; + } + + //检查设置值是否合理 + if (pCamProperty->value < struFloatValue.fMin || pCamProperty->value > struFloatValue.fMax) { + qWarning() << QString("Invalid exposure time value:%1.").arg(pCamProperty->value) + << " - " << __FUNCTION__; + return false; + } + + //设置设备增益 + float fValue = pCamProperty->value; + nRet = MV_CC_SetGain(m_hDevice, fValue); + if (MV_OK != nRet) { + qWarning() << "Failed to SetExposureTime" << TP_LOG_TAIL; + return false; + } + + qDebug() << QString("Set exposure time value:%1 successfully.").arg(pCamProperty->value) + << TP_LOG_TAIL; + } + return true; +} \ No newline at end of file diff --git a/src/lpCamera/lpCamHik/CameraHik.h b/src/lpCamera/lpCamHik/CameraHik.h new file mode 100644 index 0000000..6960606 --- /dev/null +++ b/src/lpCamera/lpCamHik/CameraHik.h @@ -0,0 +1,43 @@ +#ifndef CAMERAHIK_H +#define CAMERAHIK_H + +#include "iCameraObject.h" +#include "CameraParams.h" +#include "MvErrorDefine.h" + +class CCameraHik : public ICameraObject +{ +public: + CCameraHik(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb); + ~CCameraHik(); + + void OnImageCallBack(unsigned char* pData, MV_FRAME_OUT_INFO* pFrameInfo); + +private: + virtual int IOpenCamera(); + virtual void ICloseCamera(); + virtual int IStartCamera(); + virtual void IStopCamera(); + virtual void ISnapCamera(); + virtual void IStartPush() {} + virtual void IPausePush() {} + virtual void InitProperty(); + + virtual QList IEnumAvailableCameras(); + + // + int GetParameters(); + + void SetColorFormat(MvGvspPixelType pixType); + + virtual bool ISetProperty(TP_CAMERA_PROPERTY* pCamProperty); + +private: + void* m_hDevice; + IPoolCallback* m_pCb; + int m_width; + int m_height; + int m_pixFormat; +}; + +#endif // CAMERAHIK_H diff --git a/src/lpCamera/lpCamHik/tpCamHik.cpp b/src/lpCamera/lpCamHik/tpCamHik.cpp new file mode 100644 index 0000000..bf99ba6 --- /dev/null +++ b/src/lpCamera/lpCamHik/tpCamHik.cpp @@ -0,0 +1,14 @@ +#include "CameraHik.h" + +API_DLL_EXPORT ICameraObject* API_NAME_PREFIX(Hik_, Camera_Create)(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) +{ + return new CCameraHik(pCamOpt, pCb); +} + +API_DLL_EXPORT void API_NAME_PREFIX(Hik_, Camera_Delete)(ICameraObject* pCam) +{ + if (NULL != pCam) + { + delete pCam; + } +} \ No newline at end of file diff --git a/src/lpCamera/lpCamVirtual/CameraVirtualFolder.cpp b/src/lpCamera/lpCamVirtual/CameraVirtualFolder.cpp new file mode 100644 index 0000000..ca6ea0a --- /dev/null +++ b/src/lpCamera/lpCamVirtual/CameraVirtualFolder.cpp @@ -0,0 +1,244 @@ +#include "CameraVirtualFolder.h" +#include +#include +#include +#include +#include +#include + +CCameraVirtualFolder::CCameraVirtualFolder(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) + : ICameraObject(pCamOpt, pCb) + , m_bPreLoadImgFile(false) +{ + m_pCb = pCb; + m_pDir = NULL; + m_nIdxFile = -1; + + // 注意!注意!注意! + //为了不增加额外参数,这里使用exposure。实现的功能是: + //如果为1,那么我们会预先把实际的图片都读到内存。而不仅仅是先把图片路径保存起来 + //这样每次snap的时候,我们是直接从内存读图片,而不是根据保存的路径从磁盘IO读。 + //加快读取速度,目的是为了模拟一些对帧率要求比较高的场合。 + // m_files是保存的图片路径 + // m_preLoadImgs是保存的实际图片 + + m_bPreLoadImgFile = pCamOpt->exposure == 1; + m_files.clear(); + m_preLoadImgs.clear(); + + m_fileFilter.clear(); + m_fileFilter << "*.BMP" << "*.JPEG" << "*.JPG" << "*.PNG"; +} + +CCameraVirtualFolder::~CCameraVirtualFolder() +{ + IStopCamera(); + ICloseCamera(); + tpDebugOut("!CCameraVirtual"); + // make sure clean up + if (!m_pDir) + { + delete m_pDir; + m_pDir = NULL; + } +} + +int CCameraVirtualFolder::IOpenCamera() +{ + if (NULL == m_pCamOpt) + { + return 0; + } + + if (NULL == m_pDir) + { + m_pDir = new QDir(m_pCamOpt->folder); + if (NULL == m_pDir) + { + qWarning() << "Virtual Camera: Not a valid folder( " << m_pCamOpt->folder << " )"; + return 0; + } + + // maybe a relative path. try again. + if (!m_pDir->exists()) + { + QString strCamFolder = QCoreApplication::applicationDirPath() + "/" + m_pCamOpt->folder; + m_pDir->setPath(strCamFolder); + } + } + + if (!m_pDir->exists()) + { + qWarning() << "Virtual Camera: Folder( " << m_pCamOpt->folder << " ) not exist"; + delete m_pDir; + m_pDir = NULL; + return 0; + } + + reloadImgs(); + + m_bOpened = true; + return 1; +} + +void CCameraVirtualFolder::ICloseCamera() +{ + IStopCamera(); + m_bOpened = false; + m_bStarted = false; + + if (NULL != m_pDir) + { + delete m_pDir; + m_pDir = NULL; + } +} + + +int CCameraVirtualFolder::IStartCamera() +{ + if (!m_bOpened) return 0; + + m_oldTriggerMode = m_newTriggerMode; + ++m_nStartCount; + m_bStarted = true; + if( DEV_TRIGGER_MODE_FIXED_AUTO == m_newTriggerMode ) + { + m_nFrameNum = 0; + } + m_bStarted = true; + m_nIdxFile = -1; + return 1; +} + +void CCameraVirtualFolder::IStopCamera() +{ + if (!m_bStarted) return; + + m_files.clear(); + m_preLoadImgs.clear(); + m_bStarted = false; + m_oldTriggerMode = DEV_TRIGGER_MODE_STOP; + m_bStarted = false; +} + +void CCameraVirtualFolder::ISnapCamera() +{ + if (m_files.isEmpty()){ + reloadImgs(); + if (m_files.isEmpty()){ + qWarning() << "Virtual Camera: No image files in " << m_pCamOpt->folder; + return; + } + } + + int nTotalImgCnts = m_files.size(); + int nOriIdx = m_nIdxFile; + m_nIdxFile++; + if (m_pCamOpt->loop){ + // loop mode + if (nTotalImgCnts <= m_nIdxFile){ + m_nIdxFile = 0; + } + else if (0 > m_nIdxFile){ + m_nIdxFile = nTotalImgCnts - 1; + } + } + else{ + // sequence mode. return directly if arrive end + if (m_nIdxFile < 0 || m_nIdxFile >= nTotalImgCnts){ + m_nIdxFile = nOriIdx; + return; + } + } + + // make sure index in range + m_nIdxFile = qBound(0, m_nIdxFile, nTotalImgCnts - 1); + + QString strFileName = m_files[m_nIdxFile]; + + //QImage img(strFileName); + QImage img; + if (m_bPreLoadImgFile){ + // 使用已加载到内存的图片 + if (m_nIdxFile >= 0 && m_nIdxFile <= (m_preLoadImgs.size() - 1)){ + img = m_preLoadImgs[m_nIdxFile]; + } + } + else{ + // 根据路径,从磁盘加载图片 + img.load(strFileName); + } + + if (img.isNull()) + { + qWarning() << "Virtual Camera: Could not load image file( " << strFileName << " )"; + return; + } + ++m_nFrameNum; + m_pCameraData = (BYTE*)img.bits(); + m_nImageWidth = img.width(); + m_nImageHeight = img.height(); + m_nImageSize = img.byteCount(); + m_nBitsPerPixel = img.depth(); + QImage::Format fd = img.format(); + m_nColorFormat = TP_FUNCS::FromQImageFormat(img); + m_pCb->IPushCameraData(this); + + return; +} + +int CCameraVirtualFolder::IAutoCapture() +{ + return 0;// ISnapCamera(); +} + +bool CCameraVirtualFolder::ISetProperty(TP_CAMERA_PROPERTY* pCamProperty) +{ + if (NULL == pCamProperty) + { + return false; + } + if (TP_CAM_PROPERTY_FOLDER_NAME == pCamProperty->property) + { + ICloseCamera(); + IOpenCamera(); + } + return true; +} + +void CCameraVirtualFolder::reloadImgs() +{ + if (NULL == m_pDir) return; + + //如果是根目录。很有可能是用户设置错误或者忘记设置了。我们不加载任何图片 + // tadpole issue#39 + if (m_pDir->isRoot()) return; + + m_pDir->refresh(); + m_files.clear(); + m_preLoadImgs.clear(); + + m_nIdxFile = -1; + QDirIterator qdi(m_pDir->absolutePath(), + m_fileFilter, + QDir::NoSymLinks | QDir::Files, + QDirIterator::Subdirectories); + while (qdi.hasNext()) + { + m_files.append(qdi.next()); + } + + preLoadRealImgs(); +} + +void CCameraVirtualFolder::preLoadRealImgs() +{ + if (m_bPreLoadImgFile){ + m_preLoadImgs.clear(); + foreach(const QString& strfilename, m_files){ + QImage img(strfilename); + m_preLoadImgs.append(img); + } + } +} \ No newline at end of file diff --git a/src/lpCamera/lpCamVirtual/CameraVirtualFolder.h b/src/lpCamera/lpCamVirtual/CameraVirtualFolder.h new file mode 100644 index 0000000..658f188 --- /dev/null +++ b/src/lpCamera/lpCamVirtual/CameraVirtualFolder.h @@ -0,0 +1,41 @@ + +#ifndef CAMERAVIRTUALFOLDER_H +#define CAMERAVIRTUALFOLDER_H +#include "iCameraObject.h" +#include +#include +#include +#include + +class CCameraVirtualFolder : public ICameraObject +{ +public: + CCameraVirtualFolder(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb); + virtual ~CCameraVirtualFolder(); +private: + virtual int IOpenCamera(); + virtual void ICloseCamera(); + virtual int IStartCamera(); + virtual void IStopCamera(); + virtual void IStartPush() {} + virtual void IPausePush() {} + virtual void ISnapCamera(); + virtual int IAutoCapture(); + virtual bool ISetProperty(TP_CAMERA_PROPERTY* pCamProperty); + + void reloadImgs(); + void preLoadRealImgs(); + QStringList filterImage(const QStringList& files) { + return files.filter(QRegExp("\\.(BMP|JPEG|JPG|PNG)$", Qt::CaseInsensitive)); + } +private: + QDir* m_pDir; + QStringList m_files; + QStringList m_fileFilter; + int m_nIdxFile; + + bool m_bPreLoadImgFile; + QList m_preLoadImgs; +}; + +#endif // CAMERAVIRTUALFOLDER_H diff --git a/src/lpCamera/lpCamVirtual/tpCamVirtual.cpp b/src/lpCamera/lpCamVirtual/tpCamVirtual.cpp new file mode 100644 index 0000000..daa19dd --- /dev/null +++ b/src/lpCamera/lpCamVirtual/tpCamVirtual.cpp @@ -0,0 +1,18 @@ +// #ifdef TPCAMVIRTUAL_EXPORTS +// #define TPCAMBITFLOW_API extern "C" __declspec(dllexport) +// #else +// #define TPCAMBITFLOW_API extern "C" +// #endif + +#include "CameraVirtualFolder.h" + +API_DLL_EXPORT ICameraObject* API_NAME_PREFIX(Virtual_, Camera_Create)(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) +{ + tpDebugOut("tpCamVirtual In"); + return new CCameraVirtualFolder(pCamOpt, pCb); +} + +API_DLL_EXPORT void API_NAME_PREFIX(Virtual_, Camera_Delete)(ICameraObject* pCam) +{ + delete pCam; +} \ No newline at end of file diff --git a/src/lpCamera/tpCamBaumer/CameraBaumer.cpp b/src/lpCamera/tpCamBaumer/CameraBaumer.cpp new file mode 100644 index 0000000..388c568 --- /dev/null +++ b/src/lpCamera/tpCamBaumer/CameraBaumer.cpp @@ -0,0 +1,832 @@ +#include "CameraBaumer.h" +#include + +using namespace BGAPI2; + +#define CATCH_EXCEPTION \ + catch (Exceptions::IException& ex)\ + {\ + qCritical() << "ExceptionType: " << QString(ex.GetType()).toLocal8Bit().data() \ + << " - " __FUNCTION__; \ + qCritical() << "ErrorDescription: " << QString(ex.GetErrorDescription()).toLocal8Bit().data() \ + << " - " __FUNCTION__; \ + qCritical() << "in function: " << QString(ex.GetFunctionName()).toLocal8Bit().data() \ + << " - " __FUNCTION__; \ + } + +#define CATCH_EXCEPTION_EX(szOther) \ + catch (Exceptions::IException& ex)\ + {\ + qCritical() << szOther \ + << " - " __FUNCTION__; \ + qCritical() << "ExceptionType: " << QString(ex.GetType()).toLocal8Bit().data() \ + << " - " __FUNCTION__; \ + qCritical() << "ErrorDescription: " << QString(ex.GetErrorDescription()).toLocal8Bit().data() \ + << " - " __FUNCTION__; \ + qCritical() << "in function: " << QString(ex.GetFunctionName()).toLocal8Bit().data() \ + << " - " __FUNCTION__; \ + } + +SystemList* CCameraBaumer::s_pSysList = NULL; +int CCameraBaumer::s_nCount = 0; +CCameraBaumer::CCameraBaumer(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) + : ICameraObject(pCamOpt, pCb) + , m_pDevice(NULL) + , m_pStream(NULL) + , m_pBuffers(NULL) +{ + try + { + //rtt comment - will raise exception when the second camera initializing + //SystemList::CreateInstanceFromPath(pCb->IGetMainPath()); + s_pSysList = SystemList::GetInstance(); + if (NULL != s_pSysList) + { + s_pSysList->Refresh(); + ++s_nCount; + } + } + CATCH_EXCEPTION; + + try + { + m_imgProcessor = BGAPI2::ImageProcessor::GetInstance(); + } + + CATCH_EXCEPTION; +} + +CCameraBaumer::~CCameraBaumer() +{ + if (NULL != s_pSysList) + { + --s_nCount; + if (0 == s_nCount) + { + try + { + SystemList::ReleaseInstance(); + } + CATCH_EXCEPTION; + s_pSysList = NULL; + } + } +} + +void BGAPI2CALL FuncEventHandler(void * callBackOwner, Buffer * pBuffer) +{ + CCameraBaumer* pThis = (CCameraBaumer*)callBackOwner; + pThis->BufferReady(pBuffer); +} + +void CCameraBaumer::BufferReady(BGAPI2::Buffer * pBuffer) +{ + //test + try{ + qDebug() << __FUNCTION__; + if (pBuffer->GetPixelFormat() == "Mono8") + { + //display mono8 image + } + else if (std::string(pBuffer->GetPixelFormat()).substr(0, 4) == "Mono") + { + //convert mono10,mono12 to mono8 for displaying; + } + else if (std::string(pBuffer->GetPixelFormat()).substr(0, 4) == "RGB8") + { + //display RGB8 or RGB8Packed + } + else + { + //convert Bayer to RGB8 for displaying + BGAPI2::Image* pImage = m_imgProcessor->CreateImage((bo_uint)pBuffer->GetWidth(), (bo_uint)pBuffer->GetHeight(), pBuffer->GetPixelFormat(), pBuffer->GetMemPtr(), pBuffer->GetMemSize()); + BGAPI2::Image* pTranImage = NULL; + pImage->TransformImage("BGR8", &pTranImage); + QString strTmp = m_pCamOpt->uniqueName.toUtf8() + ","; + m_pCameraData = (BYTE*)pTranImage->GetBuffer(); + m_nImageWidth = pBuffer->GetWidth(); + m_nImageHeight = pBuffer->GetHeight(); + //m_funcFreeBuffer = NULL; //myImageCleanupFunc; + m_nFrameNum = pBuffer->GetFrameID();//++;// = pFrame->frameID + 1; + m_pCb->IPushCameraData(this); + pImage->Release(); + pTranImage->Release(); + pBuffer->QueueBuffer(); + return; + } + + + //BGAPI2::Image* pImage = m_imgProcessor->CreateImage((bo_uint)pBuffer->GetWidth(), (bo_uint)pBuffer->GetHeight(), pBuffer->GetPixelFormat(), pBuffer->GetMemPtr(), pBuffer->GetMemSize()); + //BGAPI2::Image* pTranImage = NULL; + //pImage->TransformImage("BGR8", &pTranImage); + QString strTmp = m_pCamOpt->uniqueName.toUtf8() + ","; + //LOG_SPIDER::LogString(strTmp.toLatin1() + "Baumer image get:", QString::number(QDateTime::currentMSecsSinceEpoch()).toLatin1()); + m_pCameraData = (BYTE*)pBuffer->GetMemPtr(); + m_nImageWidth = pBuffer->GetWidth(); + m_nImageHeight = pBuffer->GetHeight(); + //m_pCameraData = (BYTE*)pTranImage->GetBuffer(); + //m_nImageWidth = pBuffer->GetWidth(); + //m_nImageHeight = pBuffer->GetHeight(); + //m_funcFreeBuffer = NULL; //myImageCleanupFunc; + m_nFrameNum = pBuffer->GetFrameID();//++;// = pFrame->frameID + 1; + m_pCb->IPushCameraData(this); + //pImage->Release(); + //pTranImage->Release(); + pBuffer->QueueBuffer(); + } + CATCH_EXCEPTION; + +} + +int CCameraBaumer::IOpenCamera() +{ + qWarning("start open baumer camera..."); + if (NULL == s_pSysList) + { + return 0; + } + QStringList sKeys = m_pCamOpt->uniqueName.split(' '); + if (sKeys.size() < 2 || sKeys[0].toLower() != "baumer") + { + return 0; + } + QString szSerial = sKeys[1]; +#ifdef _USE_CAMERA_SERIAL_ENCRYPTO + szSerial = getSerial(sKeys[1]); +#endif + for (SystemList::iterator it = s_pSysList->begin(); it != s_pSysList->end(); ++it) + { + if (!openSystem(it->second)) + { + continue; + } + InterfaceList* intfList = getSystemInterfaces(it->second);// it->second->GetInterfaces(); + if (NULL != intfList) + { + for (InterfaceList::iterator itf = intfList->begin(); itf != intfList->end(); ++itf) + { + if (!openInterface(itf->second)) + { + continue; + } + DeviceList* deviceList = getDevices(itf->second); + if (NULL != deviceList) + { + m_pDevice = openDeviceBySerialNumber(deviceList, szSerial); + if (NULL != m_pDevice) + { + m_bOpened = true; + qDebug() << "Baumer camera(" << szSerial << ") open successed." + << " - " << __FUNCTION__; + + return 1; + } + } + closeInterface(itf->second); + } + } + closeSystem(it->second); + } + return 0; +} + +QList CCameraBaumer::IEnumAvailableCameras() +{ + QList ret; + + try{ + if (NULL == s_pSysList){ + s_pSysList = SystemList::GetInstance(); + } + + if (NULL != s_pSysList) + { + for (SystemList::iterator it = s_pSysList->begin(); it != s_pSysList->end(); ++it) + { + if (!openSystem(it->second)) continue; + + InterfaceList* intfList = getSystemInterfaces(it->second);// it->second->GetInterfaces(); + if (NULL != intfList){ + for (InterfaceList::iterator itf = intfList->begin(); itf != intfList->end(); ++itf) + { + if (!openInterface(itf->second)) continue; + + DeviceList* deviceList = getDevices(itf->second); + if (NULL != deviceList){ + for (DeviceList::iterator itd = deviceList->begin(); itd != deviceList->end(); ++itd) + { + QString strSerial = QString("%1 %2").arg("baumer").arg(itd->second->GetSerialNumber().get()); + ret.append(strSerial); + } + } + closeInterface(itf->second); + } + } + closeSystem(it->second); + } + } + } + CATCH_EXCEPTION; + + return ret; +} + +void CCameraBaumer::ICloseCamera() +{ + if (NULL != m_pDevice) + { + clearDeviceDataStream(m_pDevice); + closeDevice(m_pDevice); + m_pDevice = NULL; + } + m_bOpened = false; +} + +int CCameraBaumer::IStartCamera() +{ + qDebug() << __FUNCTION__; + + if (!m_bOpened || NULL == m_pDevice) + { + return 0; + } + //if (m_bHasStarted) return 1; + + //if (!m_bHasStarted || m_oldTriggerMode != m_newTriggerMode) + if (m_oldTriggerMode != m_newTriggerMode) + { + bool bSet = false; + switch (m_newTriggerMode) + { + case DEV_TRIGGER_MODE_OUT: + bSet = setDeviceOutTrigger(m_pDevice); + break; + case DEV_TRIGGER_MODE_AUTO: + case DEV_TRIGGER_MODE_FIXED_AUTO: + bSet = setDeviceAutoTrigger(m_pDevice); + if (DEV_TRIGGER_MODE_FIXED_AUTO == m_newTriggerMode) + { + m_nFrameNum = 0; + } + break; + case DEV_TRIGGER_MODE_SOFT: + bSet = setDeviceSoftTrigger(m_pDevice); + break; + default: + bSet = stopDeviceDataStream(m_pDevice); + break; + } + m_oldTriggerMode = m_newTriggerMode; + m_bStarted = bSet; + } + ++m_nStartCount; + return 1; +} + +void CCameraBaumer::IStopCamera() +{ + if (NULL != m_pDevice) + { + stopDeviceDataStream(m_pDevice); + } + m_bStarted = false; +} + +void CCameraBaumer::InitProperty() +{ + if (m_pDevice != nullptr&&m_pCamOpt != nullptr) + { + long iShutter, iMaxShutter, iMinShutter; + //set exposure + { + if (m_pDevice->GetRemoteNodeList()->GetNodePresent("ExposureTime")) + { + m_pDevice->GetRemoteNode("ExposureTime")->SetDouble(m_pCamOpt->exposure); + } + else if (m_pDevice->GetRemoteNodeList()->GetNodePresent("ExposureTimeAbs")) + { + //iShutter = (long)m_pDevice->GetRemoteNode("ExposureTimeAbs")->GetDouble(); + iMinShutter = (long)m_pDevice->GetRemoteNode("ExposureTimeAbs")->GetDoubleMin(); + iMaxShutter = (long)m_pDevice->GetRemoteNode("ExposureTimeAbs")->GetDoubleMax(); + if (m_pCamOpt->exposure < iMinShutter || m_pCamOpt->exposure > iMaxShutter) { + qWarning() << QString("Invalid exposure time value:%1.").arg(m_pCamOpt->exposure) + << " - " << __FUNCTION__; + return; + } + m_pDevice->GetRemoteNode("ExposureTimeAbs")->SetDouble(m_pCamOpt->exposure); + + qDebug() << QString("Set exposure time value:%1 successfully.").arg(m_pCamOpt->exposure) + << " - " << __FUNCTION__; + } + } + } + +} + +int CCameraBaumer::ISendSoftTrigger() +{ + if (NULL == m_pDevice) + { + return 0; + } + try + { + m_pDevice->GetRemoteNode("TriggerSoftware")->Execute(); + return 1; + } + CATCH_EXCEPTION; + return 0; +} + +emTpColorFormat CCameraBaumer::colorFormat(const QString& pixelFormat, int& nPixelSize) +{ + if ("YUV422Packed" == pixelFormat || + "Mono8" == pixelFormat) + { + nPixelSize = 8; + return TP_COLOR_Y800; + } + else if ("BayerRG12" == pixelFormat || "YUV444Packed" == pixelFormat) + { + nPixelSize = 12; + return TP_COLOR_Y800; + } + else if ("BayerRG8" == pixelFormat) + { + //nPixelSize = 8; + //return TP_COLOR_Y800; + + nPixelSize = 24; + return TP_COLOR_RGB24; + } + else if ("RGB8Packed" == pixelFormat || "BGR8Packed" == pixelFormat || "BayerRGB8Packed" == pixelFormat) + { + nPixelSize = 24; + return TP_COLOR_RGB24; + } + else if ("YUV411Packed" == pixelFormat) + { + nPixelSize = 6; + return TP_COLOR_Y800; + } + else + { + nPixelSize = 0; + return TP_COLOR_NONE; + } +} + +bool CCameraBaumer::createStreamBuffers(BGAPI2::DataStream* pStream, int nBuffers/* = 8*/) +{ + try + { + BufferList* bufferList = pStream->GetBufferList(); + // 4 buffers using internal buffer mode + for (int i = 0; i < nBuffers; i++) + { + Buffer* pBuffer = new BGAPI2::Buffer(); + if (NULL == pBuffer) + { + break; + } + bufferList->Add(pBuffer); + pBuffer->QueueBuffer(); + } + return true; + } + CATCH_EXCEPTION; + return false; +} +bool CCameraBaumer::deleteStreamBuffers(BGAPI2::DataStream* pStream) +{ + try + { + BufferList* bufferList = pStream->GetBufferList(); + if (NULL == bufferList) + { + return false; + } + // 4 buffers using internal buffer mode + for (BufferList::iterator it = bufferList->begin(); it != bufferList->end(); ++it) + { + Buffer* pBuffer = new BGAPI2::Buffer(); + if (NULL == pBuffer) + { + break; + } + bufferList->Add(pBuffer); + pBuffer->QueueBuffer(); + } + return true; + } + CATCH_EXCEPTION; + return false; +} + +bool CCameraBaumer::openSystem(BGAPI2::System* pSystem) +{ + try + { + if (pSystem->IsOpen()) + { + return true; + } + pSystem->Open(); + return true; + } + CATCH_EXCEPTION; + return false; +} +bool CCameraBaumer::closeSystem(BGAPI2::System* pSystem) +{ + return false; +} +InterfaceList* CCameraBaumer::getSystemInterfaces(BGAPI2::System* pSystem) +{ + try + { + InterfaceList* intfList = pSystem->GetInterfaces(); + if (NULL == intfList) + { + return NULL; + } + intfList->Refresh(100); + return intfList; + } + CATCH_EXCEPTION; + return NULL; +} + +bool CCameraBaumer::openInterface(BGAPI2::Interface* intf) +{ + try + { + if (intf->IsOpen()) + { + return true; + } + intf->Open(); + return true; + } + CATCH_EXCEPTION; + return false; +} +bool CCameraBaumer::closeInterface(BGAPI2::Interface* intf) +{ + return false; +} + +DeviceList* CCameraBaumer::getDevices(BGAPI2::Interface* pInterface) +{ + try + { + DeviceList* deviceList = NULL; + deviceList = pInterface->GetDevices(); + int nCount = deviceList->size(); + if (NULL == deviceList) + { + return NULL; + } + deviceList->Refresh(100); + return deviceList; + } + CATCH_EXCEPTION; + return NULL; +} + +Device* CCameraBaumer::openDeviceBySerialNumber(BGAPI2::DeviceList* devices, const QString& serialNumber) +{ + try + { + for (DeviceList::iterator itd = devices->begin(); itd != devices->end(); ++itd) + { + if (serialNumber == itd->second->GetSerialNumber()) + { + if (!openDevice(itd->second)) + { + continue; + } + if (!setDeviceProperty(itd->second) || 0 == setDeviceDataStream(itd->second)) + { + closeDevice(itd->second); + continue; + } + return (*devices)[itd->first]; + } + } + } + CATCH_EXCEPTION; + return NULL; +} + +bool CCameraBaumer::openDevice(BGAPI2::Device* pDevice) +{ + try + { + if (pDevice->IsOpen()) + { + return true; + } + pDevice->Open(); + return true; + } + CATCH_EXCEPTION; + return false; +} + +bool CCameraBaumer::closeDevice(BGAPI2::Device* pDevice) +{ + try + { + if (!pDevice->IsOpen()) + { + return true; + } + pDevice->Close(); + return true; + } + CATCH_EXCEPTION; + return false; +} + +bool CCameraBaumer::setDeviceProperty(BGAPI2::Device* pDevice) +{ + try + { + m_nColorFormat = colorFormat(QString(pDevice->GetRemoteNode("PixelFormat")->GetString()), m_nBitsPerPixel); + return true; + } + CATCH_EXCEPTION; + return false; +} + +int CCameraBaumer::setDeviceDataStream(BGAPI2::Device* pDevice) +{ + int nStreams = 0; + try + { + DataStreamList* streamList = pDevice->GetDataStreams(); + streamList->Refresh(); + for (DataStreamList::iterator its = streamList->begin(); its != streamList->end(); ++its) + { + if (!openDataStream(its->second)) + { + continue; + } + if (!createStreamBuffers(its->second)) + { + closeDataStream(its->second); + continue; + } + ++nStreams; + its->second->RegisterNewBufferEventHandler(this, (Events::NewBufferEventHandler)&FuncEventHandler); + } + } + CATCH_EXCEPTION; + return nStreams; +} + +int CCameraBaumer::clearDeviceDataStream(BGAPI2::Device* pDevice) +{ + int nStreams = 0; + try + { + DataStreamList* streamList = pDevice->GetDataStreams(); + streamList->Refresh(); + for (DataStreamList::iterator its = streamList->begin(); its != streamList->end(); ++its) + { + if (!closeDataStream(its->second)) + { + continue; + } + deleteStreamBuffers(its->second); + ++nStreams; + } + } + CATCH_EXCEPTION; + return nStreams; +} + +bool CCameraBaumer::openDataStream(BGAPI2::DataStream* pStream) +{ + try + { + if (pStream->IsOpen()) + { + return true; + } + pStream->Open(); + return true; + } + CATCH_EXCEPTION; + return false; +} + +bool CCameraBaumer::closeDataStream(BGAPI2::DataStream* pStream) +{ + try + { + if (!pStream->IsOpen()) + { + return true; + } + pStream->Close(); + return true; + } + CATCH_EXCEPTION; + return false; +} + +bool CCameraBaumer::startDeviceDataStream(BGAPI2::Device* pDevice) +{ + try + { + DataStreamList* pStreamList = pDevice->GetDataStreams(); + pStreamList->Refresh(); + for (DataStreamList::iterator it = pStreamList->begin(); it != pStreamList->end(); ++it) + { + if (!openDataStream(it->second)) + { + continue; + } + if (!it->second->GetIsGrabbing()) + { + it->second->StartAcquisitionContinuous(); + } + } + return true; + } + CATCH_EXCEPTION; + return false; +} +bool CCameraBaumer::stopDeviceDataStream(BGAPI2::Device* pDevice) +{ + try + { + DataStreamList* pStreamList = pDevice->GetDataStreams(); + pStreamList->Refresh(); + for (DataStreamList::iterator it = pStreamList->begin(); it != pStreamList->end(); ++it) + { + if (!openDataStream(it->second)) + { + continue; + } + if (it->second->GetIsGrabbing()) + { + it->second->StopAcquisition(); + } + } + return true; + } + CATCH_EXCEPTION; + return false; +} + +bool CCameraBaumer::setDeviceOutTrigger(BGAPI2::Device* pDevice) +{ + try + { + if (pDevice->GetRemoteNodeList()->GetNodePresent("AcquisitionAbort")) + { + pDevice->GetRemoteNode("AcquisitionAbort")->Execute(); + } + pDevice->GetRemoteNode("AcquisitionStop")->Execute(); + //DataStreamList* pStreamList = pDevice->GetDataStreams(); + //pStreamList->Refresh(); + //for (DataStreamList::iterator it = pStreamList->begin(); it != pStreamList->end(); ++it) + //{ + // if (!openDataStream(it->second)) + // { + // continue; + // } + // if (!it->second->GetIsGrabbing()) + // { + // it->second->StartAcquisitionContinuous(); + // } + //} + pDevice->GetRemoteNode("TriggerMode")->SetString("On"); + pDevice->GetRemoteNode("TriggerSource")->SetString("Line0"); + if (!startDeviceDataStream(pDevice)) + { + return false; + } + pDevice->GetRemoteNode("AcquisitionStart")->Execute(); + qDebug() << "Set out trigger successful." + << " - " << __FUNCTION__; + return true; + } + CATCH_EXCEPTION; + return false; +} +bool CCameraBaumer::setDeviceSoftTrigger(BGAPI2::Device* pDevice) +{ + try + { + if (pDevice->GetRemoteNodeList()->GetNodePresent("AcquisitionAbort")) + { + pDevice->GetRemoteNode("AcquisitionAbort")->Execute(); + } + + pDevice->GetRemoteNode("AcquisitionStop")->Execute(); + pDevice->GetRemoteNode("TriggerMode")->SetString("On"); + + if (pDevice->GetRemoteNode("TriggerSource")->GetEnumNodeList()->GetNodePresent("SoftwareTrigger")) + { + pDevice->GetRemoteNode("TriggerSource")->SetString("SoftwareTrigger"); + } + else + { + pDevice->GetRemoteNode("TriggerSource")->SetString("Software"); + } + + if (!startDeviceDataStream(pDevice)) + { + return false; + } + pDevice->GetRemoteNode("AcquisitionStart")->Execute(); + qDebug() << "Set soft trigger successful." + << " - " << __FUNCTION__; + + return true; + } + CATCH_EXCEPTION; + return false; +} +bool CCameraBaumer::setDeviceAutoTrigger(BGAPI2::Device* pDevice) +{ + try + { + if (pDevice->GetRemoteNodeList()->GetNodePresent("AcquisitionAbort")) + { + pDevice->GetRemoteNode("AcquisitionAbort")->Execute(); + } + pDevice->GetRemoteNode("AcquisitionStop")->Execute(); + pDevice->GetRemoteNode("TriggerMode")->SetString("Off"); + pDevice->GetRemoteNode("TriggerSource")->SetString("Line0"); + if (!startDeviceDataStream(pDevice)) + { + return false; + } + pDevice->GetRemoteNode("AcquisitionStart")->Execute(); + qDebug() << "Set auto trigger successful." + << " - " << __FUNCTION__; + + return true; + } + CATCH_EXCEPTION; + return false; +} + +void CCameraBaumer::ISnapCamera() +{ + if (!m_pDevice) + return; + + if (!setDeviceSoftTrigger(m_pDevice)) + return ; + + if (DEV_TRIGGER_MODE_OUT == m_oldTriggerMode) + { + ISendSoftTrigger(); + } +} + +bool CCameraBaumer::ISetProperty(TP_CAMERA_PROPERTY* pCamProperty) +{ + if (!pCamProperty) + return false; + + try + { + long iShutter, iMaxShutter, iMinShutter; + if (pCamProperty->property == TP_CAM_PROPERTY_EXPOSURE) + { + if (m_pDevice->GetRemoteNodeList()->GetNodePresent("ExposureTime")) + { + m_pDevice->GetRemoteNode("ExposureTime")->SetDouble(pCamProperty->value); + } + else if (m_pDevice->GetRemoteNodeList()->GetNodePresent("ExposureTimeAbs")) + { + //iShutter = (long)m_pDevice->GetRemoteNode("ExposureTimeAbs")->GetDouble(); + iMinShutter = (long)m_pDevice->GetRemoteNode("ExposureTimeAbs")->GetDoubleMin(); + iMaxShutter = (long)m_pDevice->GetRemoteNode("ExposureTimeAbs")->GetDoubleMax(); + if (pCamProperty->value < iMinShutter || pCamProperty->value > iMaxShutter){ + qWarning() << QString("Invalid exposure time value:%1.").arg(pCamProperty->value) + << " - " << __FUNCTION__; + return true; + } + m_pDevice->GetRemoteNode("ExposureTimeAbs")->SetDouble(pCamProperty->value); + + qDebug() << QString("Set exposure time value:%1 successfully.").arg(pCamProperty->value) + << " - " << __FUNCTION__; + } + } + } + CATCH_EXCEPTION + return true; +} + +bool CCameraBaumer::IGetProperty(TP_CAMERA_PROPERTY* pCamProperty) +{ + return true; +} diff --git a/src/lpCamera/tpCamBaumer/CameraBaumer.h b/src/lpCamera/tpCamBaumer/CameraBaumer.h new file mode 100644 index 0000000..0797228 --- /dev/null +++ b/src/lpCamera/tpCamBaumer/CameraBaumer.h @@ -0,0 +1,66 @@ +#ifndef CAMERABAUMER_H +#define CAMERABAUMER_H + +#include "iCameraObject.h" +#include "bgapi2_genicam.hpp" + +class CCameraBaumer : public ICameraObject +{ +public: + CCameraBaumer(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb); + ~CCameraBaumer(); + + void BufferReady(BGAPI2::Buffer * pBuffer); + +protected: + virtual int IOpenCamera(); + virtual void ICloseCamera(); + virtual int IStartCamera(); + virtual void IStopCamera(); + + virtual void IStartPush() {} + virtual void IPausePush() {} + + virtual void InitProperty(); + virtual int ISendSoftTrigger(); + virtual void ISnapCamera(); + virtual QList IEnumAvailableCameras(); + + emTpColorFormat colorFormat(const QString& pixelFormat, int& nPixelSize); + bool openSystem(BGAPI2::System* pSystem); + bool closeSystem(BGAPI2::System* pSystem); + BGAPI2::InterfaceList* getSystemInterfaces(BGAPI2::System* pSystem); + bool openInterface(BGAPI2::Interface* intf); + bool closeInterface(BGAPI2::Interface* intf); + BGAPI2::DeviceList* getDevices(BGAPI2::Interface* pInterface); + BGAPI2::Device* openDeviceBySerialNumber(BGAPI2::DeviceList* devices, const QString& serialNumber); + bool openDevice(BGAPI2::Device* pDevice); + bool closeDevice(BGAPI2::Device* pDevice); + bool setDeviceProperty(BGAPI2::Device* pDevice); + int setDeviceDataStream(BGAPI2::Device* pDevice); + int clearDeviceDataStream(BGAPI2::Device* pDevice); + bool openDataStream(BGAPI2::DataStream* pStream); + bool closeDataStream(BGAPI2::DataStream* pStream); + bool createStreamBuffers(BGAPI2::DataStream* pStream, int nBuffers = 8); + bool deleteStreamBuffers(BGAPI2::DataStream* pStream); + + bool startDeviceDataStream(BGAPI2::Device* pDevice); + bool stopDeviceDataStream(BGAPI2::Device* pDevice); + + bool setDeviceOutTrigger(BGAPI2::Device* pDevice); + bool setDeviceSoftTrigger(BGAPI2::Device* pDevice); + bool setDeviceAutoTrigger(BGAPI2::Device* pDevice); + + virtual bool ISetProperty(TP_CAMERA_PROPERTY* pCamProperty); + virtual bool IGetProperty(TP_CAMERA_PROPERTY* pCamProperty); +private: + BGAPI2::ImageProcessor* m_imgProcessor; + BGAPI2::Device* m_pDevice; + BGAPI2::DataStream* m_pStream; + BGAPI2::BufferList* m_pBuffers; + //QZkMutexMap m_onProcessBuffers; + static BGAPI2::SystemList* s_pSysList; + static int s_nCount; +}; + +#endif // CAMERABAUMER_H diff --git a/src/lpCamera/tpCamBaumer/tpCamBaumer.cpp b/src/lpCamera/tpCamBaumer/tpCamBaumer.cpp new file mode 100644 index 0000000..9a73609 --- /dev/null +++ b/src/lpCamera/tpCamBaumer/tpCamBaumer.cpp @@ -0,0 +1,15 @@ +#include "CameraBaumer.h" + +API_DLL_EXPORT ICameraObject* API_NAME_PREFIX(Baumer_, Camera_Create)(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) +{ + qWarning("create baumer camera..."); + return new CCameraBaumer(pCamOpt, pCb); +} + +API_DLL_EXPORT void API_NAME_PREFIX(Baumer_, Camera_Delete)(ICameraObject* pCam) +{ + if (NULL != pCam) + { + delete pCam; + } +} \ No newline at end of file diff --git a/src/lpCamera/tpCamGige/CameraGige.cpp b/src/lpCamera/tpCamGige/CameraGige.cpp new file mode 100644 index 0000000..86f7388 --- /dev/null +++ b/src/lpCamera/tpCamGige/CameraGige.cpp @@ -0,0 +1,351 @@ +/****************************************************************************** + Copyright(C):2015~2018 hzleaper + FileName:CameraGige.cpp + Author:zhikun wu + Email:zk.wu@hzleaper.com + Tools:vs2010 pc on company + Created:2015/05/28 + History:28:5:2015 8:55 + *******************************************************************************/ +#include "CameraGige.h" +//#include "ZkThread.h" + +CCameraGige::CCameraGige(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) + : ICameraObject(pCamOpt, pCb) + , m_pCb(pCb) +{ + m_hGrabber = NULL; + m_lMinExposure = 0; + m_lMaxExposure = 0; + m_lExposureLevel= 1000; + m_nExposure = LONG_MAX; + m_nGain = LONG_MAX; +} + +CCameraGige::~CCameraGige() +{ + tpDebugOut("~CCameraGige"); +} + +bool CCameraGige::InitLibrary(char* szLicenseKey /* = NULL */) +{ + return IC_SUCCESS == IC_InitLibrary(szLicenseKey); +} + +void CCameraGige::CloseLibrary() +{ + IC_CloseLibrary(); +} + +int CCameraGige::IOpenCamera() +{ + if( NULL == m_pCamOpt ) + { + return 0; + } + if( m_bOpened ) + { + return 1; + } + if( NULL == m_hGrabber ) + { + m_hGrabber = IC_CreateGrabber(); + if( NULL == m_hGrabber ) + { + tpDebugOut("create grabber fail"); + return 0; + } + } + //if (IC_SUCCESS != IC_OpenVideoCaptureDevice(m_hGrabber, "DFK 23G618")) + //{ + // return 0; + //} + QString fullName = m_pCamOpt->uniqueName; +#ifdef _USE_CAMERA_SERIAL_ENCRYPTO + QStringList spits = fullName.split(' '); + int nSize = spits.size(); + if (nSize == 0) + { + return 0; + } + fullName = fullName.replace(spits[nSize - 1], getSerial(spits[nSize - 1])); +#endif + + QByteArray byte = fullName.toLocal8Bit(); + char* charData = byte.data(); + + if (IC_SUCCESS != IC_OpenDevByUniqueName(m_hGrabber, charData)) + { + tpDebugOut("open device fail, device name:%s", fullName.toLatin1()); + return 0; + } + //char szSerialNumber[DEVICE_SERIAL_NUMBER_MAX_SIZE]; + //IC_GetSerialNumber(m_hGrabber, szSerialNumber); + //m_pCamOpt->serials = szSerialNumber; + int nRet = IC_SetCallbacks(m_hGrabber, FrameReadyCallback, (void*)this, DeviceLostCallback, (void*)this); + + m_bOpened = true; + + setExposure(m_pCamOpt->exposure); + setGain(m_pCamOpt->gain); + + m_nColorFormat = (emTpColorFormat)m_pCamOpt->format; + IC_SetFormat( m_hGrabber, ColorTp2Gige(m_nColorFormat) ); + + tpDebugOut("open gige device success"); + return 1; +} + +QList CCameraGige::IEnumAvailableCameras() +{ + QList ret; + + int nCnt = IC_GetDeviceCount(); + for (int i = 0; i < nCnt; i++){ + char* name = IC_GetUniqueNamefromList(i); + QString snn(name); + ret.append(snn); + } + + return ret; +} + +void CCameraGige::ICloseCamera() +{ + if( NULL != m_hGrabber ) + { + IC_StopLive(m_hGrabber); + } + if( m_bStarted ) + { + IStopCamera(); + } + if( m_bOpened ) + { + IC_CloseVideoCaptureDevice(m_hGrabber); + m_bOpened = false; + m_hGrabber = NULL; + } + tpDebugOut("ICloseCamera"); +} + +int CCameraGige::IStartCamera() +{ + if( !m_bOpened ) + { + return 0; + } + IC_EnableTrigger(m_hGrabber, 1); + IC_SetContinuousMode(m_hGrabber, 0); + IC_StartLive(m_hGrabber, 0); + switch(m_newTriggerMode) + { + case DEV_TRIGGER_MODE_OUT: + if( DEV_TRIGGER_MODE_OUT != m_oldTriggerMode ) + { + IC_EnableTrigger(m_hGrabber, 1); + } + break; + case DEV_TRIGGER_MODE_AUTO: + if( DEV_TRIGGER_MODE_AUTO != m_oldTriggerMode) + { + IC_EnableTrigger(m_hGrabber, 0); + } + break; + case DEV_TRIGGER_MODE_FIXED_AUTO: + if( DEV_TRIGGER_MODE_FIXED_AUTO != m_oldTriggerMode) + { + IC_EnableTrigger(m_hGrabber, 0); + } + break; + default: + break; + } + // + m_oldTriggerMode = m_newTriggerMode; + ++m_nStartCount; + m_bStarted = true; + if( DEV_TRIGGER_MODE_FIXED_AUTO == m_newTriggerMode ) + { + m_nFrameNum = 0; + } + tpDebugOut("start camera success"); + return 1; +} + +void CCameraGige::IStopCamera() +{ + if( m_bStarted ) + { + IC_StopLive(m_hGrabber); + waitCallback(); + m_bStarted = false; + m_oldTriggerMode = DEV_TRIGGER_MODE_STOP; + } + m_bStarted = false; + m_oldTriggerMode = DEV_TRIGGER_MODE_STOP; +} + +void CCameraGige::ISnapCamera() +{ + if (m_hGrabber) + { + tpDebugOut("Gige snap image: %s", QString::number(QDateTime::currentMSecsSinceEpoch()).toLocal8Bit().data()); + int ret = IC_SoftwareTrigger(m_hGrabber); + } +} + +void CCameraGige::waitCallback() +{ +// while( IsCallback() ) +// { +// CZkThread::msleep(25); +// } +} + +void CCameraGige::FrameReadyCallback(HGRABBER hGrabber, unsigned char* pImageData, unsigned long nFrameNumber, void* pUserData) +{ + if( NULL == pUserData ) + { + return; + } + tpDebugOut("Gige image get: %s", QString::number(QDateTime::currentMSecsSinceEpoch()).toLocal8Bit().data()); + CCameraGige* pThis = (CCameraGige*)pUserData; + if( hGrabber != pThis->m_hGrabber || NULL == pThis->m_pCb ) + { + return; + } + // pThis->setCallback(true); + pThis->FrameReady(pImageData, nFrameNumber); + // pThis->setCallback(false); +} + +void CCameraGige::DeviceLostCallback(HGRABBER hGrabber, void* pUserData) +{ + if( NULL == pUserData ) + { + return; + } + CCameraGige* pThis = (CCameraGige*)pUserData; + if( hGrabber != pThis->m_hGrabber ) + { + return; + } + pThis->DeviceLost(); +} + +void CCameraGige::FrameReady(unsigned char* pImageData, unsigned long nFrameNumber) +{ + if( NULL == m_pCamOpt || NULL == m_pCb ) + { + return; + } + if( 0 == m_nImageHeight || 0 == m_nImageWidth || 0 == m_nBitsPerPixel ) + { + COLORFORMAT colorFormat; + int nRet = IC_GetImageDescription(m_hGrabber, &m_nImageWidth, &m_nImageHeight, &m_nBitsPerPixel, &colorFormat); + nRet = 0; + } +// m_dataType = DATA_BUFFER; + m_pCameraData = pImageData; + m_nFrameNum = nFrameNumber; + m_pCb->IPushCameraData(this); +} + +void CCameraGige::DeviceLost() +{ + qWarning("*****************************cam %s lost : " , m_pCamOpt->uniqueName); +} + +void CCameraGige::setExposure(long nValue) +{ + m_pCamOpt->exposure = nValue; + int nRet = 0; + if (nValue) + { + nRet = IC_EnableAutoCameraProperty(m_hGrabber, PROP_CAM_EXPOSURE, 0); + nRet = IC_CameraPropertyGetRange(m_hGrabber, PROP_CAM_EXPOSURE, &m_lMinExposure, &m_lMaxExposure); + // nValue = m_pCamOpt->exposure * m_lExposureLevel + m_lMinExposure; + nRet = IC_SetCameraProperty(m_hGrabber, PROP_CAM_EXPOSURE, nValue); + } + else + { + nRet = IC_EnableAutoCameraProperty(m_hGrabber, PROP_CAM_EXPOSURE, 1); + } +} + +void CCameraGige::setGain(long nValue) +{ + if (nValue) + { + IC_EnableAutoVideoProperty(m_hGrabber, PROP_VID_GAIN, 0); + long nMaxGain, nMinGain; + IC_VideoPropertyGetRange(m_hGrabber, PROP_VID_GAIN, &nMinGain, &nMaxGain); + if (nValue >= nMinGain&&nValue <= nMaxGain) + { + IC_SetVideoProperty(m_hGrabber, PROP_VID_GAIN, nValue); + } + } + else + { + IC_EnableAutoVideoProperty(m_hGrabber, PROP_VID_GAIN, 1); + } +} + +bool CCameraGige::ISetProperty(TP_CAMERA_PROPERTY* pCamProperty) +{ + if (NULL == pCamProperty) + { + if (m_nExposure != m_pCamOpt->exposure) + { + setExposure(m_pCamOpt->exposure); + m_nExposure = m_pCamOpt->exposure; + } + if (m_nGain != m_pCamOpt->gain) + { + setGain(m_pCamOpt->gain); + m_nGain = m_pCamOpt->gain; + } + } + else + { + switch (pCamProperty->property) + { + case TP_CAM_PROPERTY_EXPOSURE: + m_nExposure = m_pCamOpt->exposure = pCamProperty->value; + setExposure(m_pCamOpt->exposure); + break; + case TP_CAM_PROPERTY_GAIN: + m_nGain = pCamProperty->value; + setGain(m_nGain); + break; + default: + break; + } + } + return true; +} + +bool CCameraGige::IGetProperty(TP_CAMERA_PROPERTY* pCamProperty) +{ + return true; +} + +COLORFORMAT CCameraGige::ColorTp2Gige(emTpColorFormat clrF) +{ + switch(clrF) + { + case TP_COLOR_NONE: + return NONE; + case TP_COLOR_Y800: + return Y800; + case TP_COLOR_RGB24: + return RGB24; + case TP_COLOR_RGB32: + return RGB32; + case TP_COLOR_Y16: + return Y800;//Y16; + default: + return NONE; + } +} \ No newline at end of file diff --git a/src/lpCamera/tpCamGige/CameraGige.h b/src/lpCamera/tpCamGige/CameraGige.h new file mode 100644 index 0000000..894c0df --- /dev/null +++ b/src/lpCamera/tpCamGige/CameraGige.h @@ -0,0 +1,58 @@ +/****************************************************************************** + Copyright(C):2015~2018 hzleaper + FileName:CameraGige.h + Author:zhikun wu + Email:zk.wu@hzleaper.com + Tools:vs2010 pc on company + Created:2015/05/28 + History:28:5:2015 8:55 + *******************************************************************************/ +#ifndef CAMERAGIGE_H +#define CAMERAGIGE_H + +#include "iCameraObject.h" +#include "tisgrabber.h" + +#define DEVICE_SERIAL_NUMBER_MAX_SIZE 64 + +class CCameraGige : public ICameraObject +{ +public: + CCameraGige(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb); + ~CCameraGige(); + static bool InitLibrary(char* szLicenseKey = NULL); + static void CloseLibrary(); + static COLORFORMAT ColorTp2Gige(emTpColorFormat clrF); +private: + virtual int IOpenCamera(); + virtual void ICloseCamera(); + virtual int IStartCamera(); + virtual void IStopCamera(); + virtual void ISnapCamera(); + virtual void IStartPush() {} + virtual void IPausePush() {} + + virtual bool ISetProperty(TP_CAMERA_PROPERTY* pCamProperty); + virtual bool IGetProperty(TP_CAMERA_PROPERTY* pCamProperty); + virtual QList IEnumAvailableCameras(); + + static void FrameReadyCallback(HGRABBER hGrabber, unsigned char* pImageData, unsigned long nFrameNumber, void* pUserData); + static void DeviceLostCallback(HGRABBER hGrabber, void* pUserData); + void FrameReady(unsigned char* pImageData, unsigned long nFrameNumber); + void DeviceLost(); + void setExposure(long nValue); + void setGain(long nValue); + void waitCallback(); +protected: + IPoolCallback* m_pCb; + HGRABBER m_hGrabber; + long m_lMinExposure; + long m_lMaxExposure; + long m_lExposureLevel; + long m_nExposure; + long m_nGain; +private: + +}; + +#endif // CAMERAGIGE_H diff --git a/src/lpCamera/tpCamGige/tpCamGige.cpp b/src/lpCamera/tpCamGige/tpCamGige.cpp new file mode 100644 index 0000000..32dd1ff --- /dev/null +++ b/src/lpCamera/tpCamGige/tpCamGige.cpp @@ -0,0 +1,43 @@ +/****************************************************************************** + Copyright(C):2015~2018 hzleaper + FileName:tpCamGige.cpp + Author:zhikun wu + Email:zk.wu@hzleaper.com + Tools:vs2010 pc on company + Created:2015/05/28 + History:28:5:2015 8:53 + *******************************************************************************/ +#include "CameraGige.h" +//#include "QZkMutexList.h" + +bool g_bGigeInitialized = false; +//QZkMutexList g_objList; + +API_DLL_EXPORT ICameraObject* API_NAME_PREFIX(Gige_, Camera_Create)(TP_CAMERA_OPTION* pCamOpt, IPoolCallback* pCb) +{ + if( !g_bGigeInitialized ) + { + g_bGigeInitialized = CCameraGige::InitLibrary(); + if( !g_bGigeInitialized ) + { + return NULL; + } + } + ICameraObject* pObj = new CCameraGige(pCamOpt, pCb); +// if( NULL != pObj ) +// { +// g_objList.append(pObj); +// } + return pObj; +} + +API_DLL_EXPORT void API_NAME_PREFIX(Gige_, Camera_Delete)(ICameraObject* pCam) +{ + delete pCam; + //g_objList.removeOne(pCam); + //if( g_objList.isEmpty() ) + { +// CCameraGige::CloseLibrary();//** make QApplication to crash when quit + g_bGigeInitialized = false; + } +} \ No newline at end of file diff --git a/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj b/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj index 409df53..f671a70 100644 --- a/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj +++ b/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj @@ -19,11 +19,11 @@ - - + - + + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF} diff --git a/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj.filters b/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj.filters index 2081634..26ca539 100644 --- a/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj.filters +++ b/tpvs17/tpCamVirtual/tpCamVirtual.vcxproj.filters @@ -25,6 +25,11 @@ False + + + Header Files + + Source Files @@ -33,9 +38,4 @@ Source Files - - - Header Files - - \ No newline at end of file diff --git a/tpvs17/wheel.sln b/tpvs17/wheel.sln index 03b9b4e..4e3d525 100644 --- a/tpvs17/wheel.sln +++ b/tpvs17/wheel.sln @@ -25,6 +25,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "valveDetector", "valveDetec EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lpCoreCtrl", "lpCoreCtrl\lpCoreCtrl.vcxproj", "{784071A9-BF94-4D27-B62E-588ACD7E0633}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tpCamVirtual", "tpCamVirtual\tpCamVirtual.vcxproj", "{707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -103,12 +105,20 @@ Global {784071A9-BF94-4D27-B62E-588ACD7E0633}.Release|x64.ActiveCfg = Release|x64 {784071A9-BF94-4D27-B62E-588ACD7E0633}.Release|x64.Build.0 = Release|x64 {784071A9-BF94-4D27-B62E-588ACD7E0633}.Release|x86.ActiveCfg = Release|x64 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Debug|x64.ActiveCfg = Debug|x64 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Debug|x64.Build.0 = Debug|x64 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Debug|x86.ActiveCfg = Debug|Win32 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Debug|x86.Build.0 = Debug|Win32 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Release|x64.ActiveCfg = Release|x64 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Release|x64.Build.0 = Release|x64 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Release|x86.ActiveCfg = Release|Win32 + {707DDF6F-B78B-42F7-9EAD-E786C0FCD5FF}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {CD365F32-5EAC-4A16-AD47-BFB1D8E5511A} Qt5Version = qt5.9.4-msvc2017-x64 + SolutionGuid = {CD365F32-5EAC-4A16-AD47-BFB1D8E5511A} EndGlobalSection EndGlobal