添加项目文件。
This commit is contained in:
66
Plugin/Fast/BaseCamera.cpp
Normal file
66
Plugin/Fast/BaseCamera.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
// MsgHandleDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Fast.h"
|
||||
#include "BaseCamera.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
#define TIMER_LOGIN 10
|
||||
#define TIMER_CLEAR_RECORD 22
|
||||
|
||||
|
||||
// CMsgHandleDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CBaseCamera, CDialog)
|
||||
|
||||
CBaseCamera::CBaseCamera(int nIdx, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(IDD_DLG_CAM, pParent)
|
||||
{
|
||||
m_nCameraIdx = nIdx;
|
||||
m_pParentWnd = pParent;
|
||||
}
|
||||
|
||||
CBaseCamera::~CBaseCamera()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CBaseCamera::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CBaseCamera, CDialog)
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CMsgHandleDlg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
BOOL CBaseCamera::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
|
||||
void CBaseCamera::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
}
|
||||
|
||||
void CBaseCamera::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
33
Plugin/Fast/BaseCamera.h
Normal file
33
Plugin/Fast/BaseCamera.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CMsgHandleDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
class CBaseCamera : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CBaseCamera)
|
||||
|
||||
public:
|
||||
CBaseCamera(int nIdx, CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CBaseCamera();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_DLG_CAM};
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
CWnd *m_pParentWnd;
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
virtual void Sample() {};
|
||||
|
||||
public:
|
||||
int m_nCameraIdx;
|
||||
int m_nCameraState;
|
||||
|
||||
};
|
||||
509
Plugin/Fast/DahuaFisheyeCamera.cpp
Normal file
509
Plugin/Fast/DahuaFisheyeCamera.cpp
Normal file
@@ -0,0 +1,509 @@
|
||||
// MsgHandleDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "Fast.h"
|
||||
#include "DahuaFisheyeCamera.h"
|
||||
#include "FastView.h"
|
||||
#include "dhplay.h"
|
||||
|
||||
|
||||
#define TIMER_LOGIN 10
|
||||
|
||||
|
||||
// CMsgHandleDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CDahuaFisheyeCamera, CBaseCamera)
|
||||
|
||||
CDahuaFisheyeCamera::CDahuaFisheyeCamera(CFastView * pParentWnd, int nIdx, ENUM_PLAY_TYPE enPlayType, CWnd* pParent /*=NULL*/)
|
||||
: CBaseCamera(IDD_DLG_CAM, pParentWnd)
|
||||
{
|
||||
m_nCameraIdx = nIdx;
|
||||
m_nIndex = 0;
|
||||
m_pParentWnd = pParentWnd;
|
||||
m_hCameraHandle = NULL;
|
||||
m_nPlayTyp = enPlayType;
|
||||
}
|
||||
|
||||
CDahuaFisheyeCamera::~CDahuaFisheyeCamera()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CDahuaFisheyeCamera::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDahuaFisheyeCamera, CDialog)
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_TIMER()
|
||||
ON_MESSAGE(WM_CAMERA_SNAP, &CDahuaFisheyeCamera::OnSnap)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/*
|
||||
int GetDahuaCameraIdxByLoginID(CDahuaFisheyeCamera *pThis, LLONG lLoginID)
|
||||
{
|
||||
for (int i = 0; i < theApp.m_nCameraCount; i++)
|
||||
{
|
||||
if (theApp.m_CameraArray[i].lLoginId == lLoginID)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
//<2F><><EFBFBD>ص<DFBB>
|
||||
void CALLBACK DahuaDisConnectFunc(LLONG lLoginID, char *pchDVRIP, LONG nDVRPort, LDWORD dwUser)
|
||||
{
|
||||
if (dwUser == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CDahuaFisheyeCamera *pThis = (CDahuaFisheyeCamera *)dwUser;
|
||||
TRACE("[%I64d - %d]*********************** <20>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD> *********************\r\n", lLoginID, pThis->m_hWnd);
|
||||
|
||||
HWND hWnd = pThis->GetSafeHwnd();
|
||||
if (NULL == hWnd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//int nIdx = GetDahuaCameraIdxByLoginID(pThis, lLoginID);
|
||||
if (pThis->m_lLoginId == lLoginID)
|
||||
{
|
||||
pThis->m_nCameraState = 0;
|
||||
}
|
||||
|
||||
|
||||
//pThis->m_pParentWnd->RefreshCameraList();
|
||||
//pThis->m_pParentWnd->VoiceReminder();
|
||||
}
|
||||
|
||||
void CALLBACK DahuaReConnectFunc(LLONG lLoginID, char *pchDVRIP, LONG nDVRPort, LDWORD dwUser)
|
||||
{
|
||||
if (dwUser == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CDahuaFisheyeCamera *pThis = (CDahuaFisheyeCamera *)dwUser;
|
||||
TRACE("[%I64d - %d]*********************** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *********************\r\n", lLoginID, pThis->m_hWnd);
|
||||
HWND hWnd = pThis->GetSafeHwnd();
|
||||
if (NULL == hWnd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (pThis->m_lLoginId == lLoginID)
|
||||
{
|
||||
pThis->m_nCameraState = 1;
|
||||
}
|
||||
//int nIdx = GetDahuaCameraIdxByLoginID(pThis, lLoginID);
|
||||
//pThis->m_nCameraState = 1;
|
||||
|
||||
//pThis->m_pParentWnd->RefreshCameraList();
|
||||
//pThis->m_pParentWnd->VoiceReminder();
|
||||
}
|
||||
|
||||
void CALLBACK DahuaSnapPicRet(LLONG lLoginID, BYTE *pBuf, UINT RevLen, UINT EncodeType, DWORD CmdSerial, LDWORD dwUser)
|
||||
{
|
||||
|
||||
CDahuaFisheyeCamera *pThis = (CDahuaFisheyeCamera*)dwUser;
|
||||
|
||||
if (pThis->m_lLoginId == lLoginID)
|
||||
{
|
||||
CTime currentTime = CTime::GetCurrentTime(); // <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1>
|
||||
CString dateStr = currentTime.Format(_T("%Y_%m_%d")); // <20><>ʽ<EFBFBD><CABD>Ϊ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
CString tiemStr = currentTime.Format(_T("%H_%M_%S")); // <20><>ʽ<EFBFBD><CABD>Ϊ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
CString strPath = theApp.m_strDataPath + "\\" + dateStr;
|
||||
|
||||
if (!PathIsDirectory(strPath))//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
CreateDirectory(strPath, NULL);//<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
}
|
||||
|
||||
//ԭͼ
|
||||
char acFileName[256] = "";
|
||||
sprintf(acFileName, "%s\\%s-%d.jpg", strPath, tiemStr, pThis->m_nCameraIdx);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
|
||||
//char acAnalysisName[256] = "";
|
||||
//sprintf(acAnalysisName, "%s\\analysis-%d.JPG", strPath, 0);
|
||||
|
||||
|
||||
|
||||
/* Save image original file */
|
||||
FILE *stream;
|
||||
if ((stream = fopen((const char*)acFileName, "wb")) != NULL)
|
||||
{
|
||||
int numwritten = fwrite(pBuf, sizeof(char), RevLen, stream);
|
||||
fclose(stream);
|
||||
}
|
||||
|
||||
pThis->m_pParentWnd->StartPlay(acFileName);
|
||||
|
||||
|
||||
//theApp.m_CameraArray[nIdx].strImagePath[0] = acFileName;
|
||||
//theApp.m_CameraArray[nIdx].strImagePath[1] = acAnalysisName;
|
||||
//pThis->m_pParentWnd->ShowCameraImage(acFileName, nIdx);
|
||||
//SetEvent(theApp.m_EventHandles[nIdx]);
|
||||
|
||||
/*if (theApp.m_CameraArray[nIdx].bAnalysis == TRUE)
|
||||
{
|
||||
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
||||
ParseImage(pThis, acFileName, acAnalysisName, nIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetEvent(theApp.m_EventHandles[nIdx]);
|
||||
theApp.m_CameraArray[nIdx].strImagePath[0] = acFileName;
|
||||
theApp.m_CameraArray[nIdx].strImagePath[1] = acFileName;
|
||||
pThis->m_pParentWnd->ShowCameraImage(acFileName, nIdx);
|
||||
}*/
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// netsdk ʵʱ<CAB5>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CALL_METHOD fRealDataCB(LLONG lRealHandle, DWORD dwDataType, BYTE *pBuffer, DWORD dwBufSize, LDWORD dwUser)
|
||||
{
|
||||
|
||||
CDahuaFisheyeCamera *pWnd = (CDahuaFisheyeCamera*)dwUser;
|
||||
if (pWnd->m_lRealHandle != lRealHandle)return;
|
||||
|
||||
// <20>Ѵ<EFBFBD><D1B4><EFBFBD>ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>playsdk<64><6B>
|
||||
PLAY_InputData(pWnd->m_nWndID, pBuffer, dwBufSize);
|
||||
return;
|
||||
}
|
||||
|
||||
// playsdk <20>ص<EFBFBD> yuv<75><76><EFBFBD><EFBFBD>
|
||||
void CALL_METHOD fDisplayCB(LONG nPort, char * pBuf, LONG nSize, LONG nWidth, LONG nHeight, LONG nStamp, LONG nType, void* pReserved)
|
||||
{
|
||||
|
||||
CDahuaFisheyeCamera *pShowWnd = (CDahuaFisheyeCamera *)(pReserved);
|
||||
|
||||
if (pShowWnd->m_nWndID != nPort)return;
|
||||
|
||||
//TRACE("%d\n", pThis->m_nWndID);
|
||||
|
||||
|
||||
//if (pThis->m_nWndID > 1)return;
|
||||
pShowWnd->m_nIndex++;
|
||||
if (pShowWnd->m_nIndex == 10)
|
||||
{
|
||||
|
||||
cv::Mat cv_img;
|
||||
cv::Mat cv_yuv(nHeight + nHeight / 2, nWidth, CV_8UC1, pBuf);//pFrameΪYUV<55><56><EFBFBD>ݵ<EFBFBD>ַ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CV_8UC1<43><31> CV_8UC3.
|
||||
cv_img = cv::Mat(nHeight, nWidth, CV_8UC3);
|
||||
cv::cvtColor(cv_yuv, cv_img, cv::COLOR_YUV2BGR_I420); //cv::COLOR_YUV2BGR_I420
|
||||
//cv::imshow("video", cv_img);
|
||||
|
||||
cv::Mat imgTmp;
|
||||
|
||||
CRect rect;
|
||||
pShowWnd->GetClientRect(&rect); // <20><>ȡ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>С
|
||||
int nWidth = cv_img.cols * rect.Height() *1.0 / cv_img.rows;
|
||||
|
||||
if (rect.Width() == 0)return;
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭվչƽ
|
||||
//if (theApp.m_bCalibrator)
|
||||
//{
|
||||
// cv_img = CImageCalibrator::imageCalibration(cv_img);
|
||||
//}
|
||||
|
||||
cv::resize(cv_img, imgTmp, cv::Size(nWidth, rect.Height()));// <20><><EFBFBD><EFBFBD>Mat<61><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
pShowWnd->m_nIndex = 0;
|
||||
pShowWnd->m_pParentWnd->DrawMat(imgTmp, (rect.Width() - nWidth) / 2);
|
||||
cv::waitKey(10);
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CString CDahuaFisheyeCamera::ConvertString(CString strText)
|
||||
{
|
||||
char *val = new char[200];
|
||||
CString strIniPath, strRet;
|
||||
|
||||
memset(val, 0, 200);
|
||||
GetPrivateProfileString("String", strText, "",
|
||||
val, 200, "./langchn.ini");
|
||||
strRet = val;
|
||||
if (strRet.GetLength() == 0)
|
||||
{
|
||||
//If there is no corresponding string in ini file then set it to be deafault value(English).
|
||||
strRet = strText;
|
||||
}
|
||||
delete[] val;
|
||||
return strRet;
|
||||
}
|
||||
|
||||
//Display log in failure reason
|
||||
void CDahuaFisheyeCamera::ShowLoginErrorReason(int nError)
|
||||
{
|
||||
if (1 == nError) MessageBox(ConvertString("Invalid password!"), ConvertString("Prompt"));
|
||||
else if (2 == nError) MessageBox(ConvertString("Invalid account!"), ConvertString("Prompt"));
|
||||
else if (3 == nError) MessageBox(ConvertString("Timeout!"), ConvertString("Prompt"));
|
||||
else if (4 == nError) MessageBox(ConvertString("The user has logged in!"), ConvertString("Prompt"));
|
||||
else if (5 == nError) MessageBox(ConvertString("The user has been locked!"), ConvertString("Prompt"));
|
||||
else if (6 == nError) MessageBox(ConvertString("The user has listed into illegal!"), ConvertString("Prompt"));
|
||||
else if (7 == nError) MessageBox(ConvertString("The system is busy!"), ConvertString("Prompt"));
|
||||
else if (9 == nError) MessageBox(ConvertString("You Can't find the network server!"), ConvertString("Prompt"));
|
||||
else MessageBox(ConvertString("Login failed!"), ConvertString("Prompt"));
|
||||
}
|
||||
|
||||
|
||||
// CMsgHandleDlg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
BOOL CDahuaFisheyeCamera::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
InitCameraSDK();
|
||||
|
||||
|
||||
CString strIpAddr = "192.168.0.102";
|
||||
int nPort = 37777;
|
||||
CString strUser = "admin";
|
||||
CString strPW = "wdq@2023";
|
||||
m_lLoginId = Login(strIpAddr, nPort, strUser, strPW);
|
||||
|
||||
if (m_lLoginId > 0)
|
||||
{
|
||||
m_nCameraState = 1;
|
||||
KillTimer(TIMER_LOGIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nCameraState = 0;
|
||||
SetTimer(TIMER_LOGIN, 10000, NULL);
|
||||
}
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL CDahuaFisheyeCamera::InitCameraSDK()
|
||||
{
|
||||
|
||||
TRACE("[%d - %d]*********************** InitNetSDK *********************\r\n", m_nCameraIdx, this->m_hWnd);
|
||||
BOOL ret = CLIENT_Init(DahuaDisConnectFunc, (LDWORD)this);
|
||||
if (ret)
|
||||
{
|
||||
LOG_SET_PRINT_INFO stLogPrintInfo = { sizeof(stLogPrintInfo) };
|
||||
CLIENT_LogOpen(&stLogPrintInfo);
|
||||
CLIENT_SetSnapRevCallBack(DahuaSnapPicRet, (LDWORD)this);
|
||||
CLIENT_SetAutoReconnect(DahuaReConnectFunc, (LDWORD)this);
|
||||
//CLIENT_SetConnectTime(0, 0);
|
||||
TRACE("[%d - %d]*********************** InitNetSDK SUCCEED*********************\r\n", m_nCameraIdx, this->m_hWnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(ConvertString("initialize SDK failed!"), ConvertString("prompt"));
|
||||
}
|
||||
|
||||
// <20><>ʼ<EFBFBD><CABC><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
NET_PARAM stuNetParam = { 0 };
|
||||
// Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣʱ<CFA2>䣨<EFBFBD><E4A3A8><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬û<E2A3AC><C3BB><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϣ<EFBFBD>
|
||||
stuNetParam.nGetDevInfoTime = 3000;
|
||||
CLIENT_SetNetworkParam(&stuNetParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LLONG CDahuaFisheyeCamera::Login(CString strIpAddr, int nPort, CString strUser, CString strPW)
|
||||
{
|
||||
//<2F><><EFBFBD>ε<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>¼ID
|
||||
NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY stInparam;
|
||||
memset(&stInparam, 0, sizeof(stInparam));
|
||||
stInparam.dwSize = sizeof(stInparam);
|
||||
strncpy(stInparam.szIP, strIpAddr.GetBuffer(), strIpAddr.GetLength());
|
||||
strncpy(stInparam.szPassword, strPW.GetBuffer(), strPW.GetLength());
|
||||
strncpy(stInparam.szUserName, strUser.GetBuffer(), strUser.GetLength());
|
||||
stInparam.nPort = nPort;
|
||||
stInparam.emSpecCap = EM_LOGIN_SPEC_CAP_TCP;
|
||||
|
||||
NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY stOutparam;
|
||||
memset(&stOutparam, 0, sizeof(stOutparam));
|
||||
stOutparam.dwSize = sizeof(stOutparam);
|
||||
LLONG lLoginHandle = CLIENT_LoginWithHighLevelSecurity(&stInparam, &stOutparam);
|
||||
|
||||
if (0 == lLoginHandle)
|
||||
{
|
||||
//Display log in failure reason
|
||||
//ShowLoginErrorReason(stOutparam.nError);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SNAP_PICTURE == m_nPlayTyp)
|
||||
{
|
||||
//m_LoginID = lRet;
|
||||
int nRetLen = 0;
|
||||
NET_DEV_CHN_COUNT_INFO stuChn = { sizeof(NET_DEV_CHN_COUNT_INFO) };
|
||||
stuChn.stuVideoIn.dwSize = sizeof(stuChn.stuVideoIn);
|
||||
stuChn.stuVideoOut.dwSize = sizeof(stuChn.stuVideoOut);
|
||||
BOOL bRet = CLIENT_QueryDevState(lLoginHandle, DH_DEVSTATE_DEV_CHN_COUNT, (char*)&stuChn, stuChn.dwSize, &nRetLen);
|
||||
if (!bRet)
|
||||
{
|
||||
DWORD dwError = CLIENT_GetLastError() & 0x7fffffff;
|
||||
}
|
||||
|
||||
}
|
||||
else if (RT_STREAMING == m_nPlayTyp)
|
||||
{
|
||||
PLAY_GetFreePort(&m_nWndID);
|
||||
PLAY_SetStreamOpenMode(m_nWndID, STREAME_REALTIME);
|
||||
PLAY_OpenStream(m_nWndID, NULL, 0, 1024 * 512 * 6);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶץͼ<D7A5>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Իص<D4BB><D8B5><EFBFBD>YUV<55><56><EFBFBD><EFBFBD>
|
||||
PLAY_SetDisplayCallBack(m_nWndID, fDisplayCB, this);
|
||||
PLAY_Play(m_nWndID, NULL);
|
||||
//<2F><><EFBFBD><EFBFBD>
|
||||
m_lRealHandle = CLIENT_RealPlayEx(lLoginHandle, 0, 0);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
|
||||
CLIENT_SetRealDataCallBack(m_lRealHandle, fRealDataCB, (LDWORD)this);
|
||||
}
|
||||
return lLoginHandle;
|
||||
}
|
||||
//SetWindowText(ConvertString("CapturePicture"));
|
||||
|
||||
|
||||
/*
|
||||
char *pchDVRIP;
|
||||
//CString strDvrIP = GetDvrIP();
|
||||
pchDVRIP = (LPSTR)(LPCSTR)strIpAddr;
|
||||
WORD wDVRPort = (WORD)nPort;
|
||||
char *pchUserName = (LPSTR)(LPCSTR)strUser;
|
||||
char *pchPassword = (LPSTR)(LPCSTR)strPW;
|
||||
|
||||
|
||||
|
||||
|
||||
NET_DEVICEINFO_Ex stLoginInfo = { 0 };
|
||||
int nErrcode = 0;
|
||||
|
||||
LLONG lLoginHandle = CLIENT_LoginEx2(pchDVRIP, nPort, pchUserName, pchPassword, (EM_LOGIN_SPAC_CAP_TYPE)0, NULL, &stLoginInfo, &nErrcode);
|
||||
if (0 == lLoginHandle)
|
||||
{
|
||||
//cout << "Login device failed" << endl;
|
||||
//cin >> szIpAddr;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//cout << "Login device success" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (0 == m_lRealHandle)
|
||||
{
|
||||
//cout << "CLIENT_RealPlayEx fail!" << endl;
|
||||
Sleep(100000);
|
||||
return -1;
|
||||
}
|
||||
//cout << "CLIENT_RealPlayEx success!" << endl;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
LRESULT CDahuaFisheyeCamera::OnSnap(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
//AfxMessageBox("<22><><EFBFBD><EFBFBD>");
|
||||
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>
|
||||
if (m_nCameraState == 0)
|
||||
return 0;
|
||||
|
||||
//Fill in request structure
|
||||
SNAP_PARAMS snapparams = { 0 };
|
||||
snapparams.Channel = 0;
|
||||
snapparams.mode = 0;
|
||||
snapparams.CmdSerial = 0;
|
||||
|
||||
BOOL b = CLIENT_SnapPicture(m_lLoginId, snapparams);
|
||||
if (!b)
|
||||
{
|
||||
//<2F><><EFBFBD>ӳɹ<D3B3><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽʧ<CABD>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
//MessageBox(ConvertString("begin to snap failed!"), ConvertString("prompt"));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CDahuaFisheyeCamera::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
||||
if (nIDEvent == TIMER_LOGIN)
|
||||
{
|
||||
//<2F>豸<EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
|
||||
}
|
||||
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
|
||||
void CDahuaFisheyeCamera::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CDahuaFisheyeCamera::TargetDetection(int nCameraIdx, cv::Mat &mat_img, vector<CRect> &findRects)
|
||||
{
|
||||
CRect findRect;
|
||||
try {
|
||||
cv::Mat dst = mat_img;
|
||||
//cv::Size newSize(mat_img.size().width / 4, mat_img.size().height / 4); // <20><><EFBFBD><EFBFBD><EFBFBD>µijߴ<C4B3>
|
||||
//cv::resize(mat_img, dst, newSize); // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ߴ<EFBFBD>
|
||||
|
||||
auto det_image = theApp.m_yoloV4.m_pDetector->mat_to_image_resize(dst);
|
||||
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
std::vector<bbox_t> result_vec = theApp.m_yoloV4.m_pDetector->detect_resized(*det_image, dst.size().width, dst.size().height);
|
||||
auto end = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> spent = end - start;
|
||||
std::cout << " Time: " << spent.count() << " sec \n";
|
||||
|
||||
theApp.m_yoloV4.DrawObjectBoxes(dst, result_vec, theApp.m_yoloV4.m_vObjects_Names);
|
||||
|
||||
for (int i = 0; i < result_vec.size(); i++)
|
||||
{
|
||||
bbox_t result_area = result_vec.at(i);
|
||||
std::string obj_name = theApp.m_yoloV4.m_vObjects_Names[result_area.obj_id];
|
||||
//if (result_area.prob >= 0.9 && (0 == obj_name.compare("up") ))
|
||||
{
|
||||
CRect rect;
|
||||
rect.left = result_area.x;
|
||||
rect.top = result_area.y;
|
||||
rect.right = result_area.x + result_area.w;
|
||||
rect.bottom = result_area.y + result_area.h;
|
||||
findRects.push_back(rect);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (std::exception &e) { std::cerr << "exception: " << e.what() << "\n"; getchar(); }
|
||||
catch (...) { std::cerr << "unknown exception \n"; getchar(); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
50
Plugin/Fast/DahuaFisheyeCamera.h
Normal file
50
Plugin/Fast/DahuaFisheyeCamera.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseCamera.h"
|
||||
#include "dhnetsdk.h"
|
||||
#include "dhconfigsdk.h"
|
||||
|
||||
class CFastView;
|
||||
class CDahuaFisheyeCamera : public CBaseCamera
|
||||
{
|
||||
DECLARE_DYNAMIC(CDahuaFisheyeCamera)
|
||||
|
||||
public:
|
||||
CDahuaFisheyeCamera(CFastView *, int nIdx, ENUM_PLAY_TYPE enPlayType, CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CDahuaFisheyeCamera();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_DLG_CAM};
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
CFastView *m_pParentWnd;
|
||||
ENUM_PLAY_TYPE m_nPlayTyp;
|
||||
void* m_hCameraHandle;
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg LRESULT OnSnap(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
BOOL InitCameraSDK();
|
||||
CString ConvertString(CString strText);
|
||||
void ShowLoginErrorReason(int nError);
|
||||
LLONG Login(CString strIpAddr, int nPort, CString strUser, CString strPW);
|
||||
void TargetDetection(int nCameraIdx, cv::Mat &mat_img, vector<CRect> &findRects);
|
||||
void TargetPosition(unsigned char* pDepthData, vector<CRect> &findRects, cv::Point3f& coordinate, CRect& rect) {};
|
||||
|
||||
public:
|
||||
int m_nCameraIdx;
|
||||
LLONG m_lLoginId;
|
||||
LONG m_nWndID;
|
||||
int m_nIndex;
|
||||
LLONG m_lRealHandle;
|
||||
|
||||
|
||||
|
||||
};
|
||||
143
Plugin/Fast/Fast.cpp
Normal file
143
Plugin/Fast/Fast.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
|
||||
// Vcs-Client.cpp : <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Fast.h"
|
||||
#include "FastMainDialog.h"
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
CCEXPipeClientBase* g_pstPipeClient = CCEXPipeClientBase::CreateObj();
|
||||
// CVcsClientApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFastApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CFastApp::CFastApp()
|
||||
{
|
||||
// ֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||
|
||||
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> InitInstance <20><>
|
||||
m_strDataPath = "d:\\";
|
||||
}
|
||||
|
||||
|
||||
// Ψһ<CEA8><D2BB>һ<EFBFBD><D2BB> CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CFastApp theApp;
|
||||
|
||||
|
||||
BOOL CFastApp::InitInstance()
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows XP <20>ϵ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD>嵥ָ<E5B5A5><D6B8>Ҫ
|
||||
// ʹ<><CAB9> ComCtl32.dll <20>汾 6 <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ӻ<EFBFBD><D3BB><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
//<2F><><EFBFBD><EFBFBD>Ҫ InitCommonControlsEx()<29><> <20><><EFBFBD><EFBFBD><F2A3ACBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
|
||||
INITCOMMONCONTROLSEX InitCtrls;
|
||||
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC>ࡣ
|
||||
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||
InitCommonControlsEx(&InitCtrls);
|
||||
CWinApp::InitInstance();
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20>κ<EFBFBD> shell <20><><EFBFBD><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> shell <20>б<EFBFBD><D0B1><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>
|
||||
CShellManager *pShellManager = new CShellManager;
|
||||
// <20><><EFBFBD>Windows Native<76><65><EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||
|
||||
// <20><><EFBFBD><D7BC>ʼ<EFBFBD><CABC>
|
||||
// <20><><EFBFBD><EFBFBD>δʹ<CEB4><CAB9><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ܲ<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>С
|
||||
// <20><><EFBFBD>տ<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD>õ<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// TODO: Ӧ<>ʵ<EFBFBD><CAB5>ĸ<DEB8><C4B8>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>֯<EFBFBD><D6AF>
|
||||
SetRegistryKey(_T("Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵı<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
char acPath[2048] = { 0 };
|
||||
GetModuleFileName(NULL, acPath, 2048);
|
||||
CString strConf(acPath);
|
||||
strConf = strConf.Left(strConf.ReverseFind('\\'));
|
||||
m_strCfgFilePath = strConf + "\\config.ini";
|
||||
|
||||
|
||||
CFastMainDialog dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// <20><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
}
|
||||
else if (nResponse == -1)
|
||||
{
|
||||
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20>Ի<EFBFBD><D4BB><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>\n");
|
||||
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS<47><53>\n");
|
||||
}
|
||||
|
||||
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>洴<EFBFBD><E6B4B4><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (pShellManager != NULL)
|
||||
{
|
||||
delete pShellManager;
|
||||
}
|
||||
|
||||
#ifndef _AFXDLL
|
||||
ControlBarCleanUp();
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD>ѹرգ<D8B1><D5A3><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD> FALSE <20>Ա<EFBFBD><D4B1>˳<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>á<EFBFBD>
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CString CFastApp::SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param)
|
||||
{
|
||||
LogOutToFile("FAST::SendMsg2Platform Begin");
|
||||
|
||||
Json::Value root;
|
||||
root["sender"] = "FAST"; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,SwingArm
|
||||
root["receiver"] = strReceiver.GetBuffer();
|
||||
|
||||
/******************************************************
|
||||
nMsgTypeʹ<65><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CREATE_TASK_RET = 2, //WCS->WMS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
EXECUTE_TASK_RET = 4, //WCS->WMS ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
DEVICE_STATE_REPORT = 5, //WCS->WMS <20>豸״̬<D7B4>ϱ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
DEVICE_CONFIG_REQ = 6, //WCS->WMS <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*******************************************************/
|
||||
|
||||
root["type"] = nMsgType;
|
||||
root["params"] = param;
|
||||
|
||||
Json::FastWriter writer;
|
||||
string strJson = writer.write(root);
|
||||
|
||||
g_pstPipeClient->SendeMsg(WCS_2_WMS_DATA, (char*)strJson.c_str(), strJson.length());
|
||||
|
||||
LogOutToFile("FAST::SendMsg2Platform End");
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
43
Plugin/Fast/Fast.h
Normal file
43
Plugin/Fast/Fast.h
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
// Vcs-Client.h : PROJECT_NAME Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error "<22>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>stdafx.h<><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PCH <20>ļ<EFBFBD>"
|
||||
#endif
|
||||
|
||||
#include "resource.h" // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#include "CCEXPipeLib.h"
|
||||
#include "YoloV4.h"
|
||||
|
||||
|
||||
// CVcsClientApp:
|
||||
// <20>йش<D0B9><D8B4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Vcs-Client.cpp
|
||||
//
|
||||
|
||||
class CFastApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CFastApp();
|
||||
|
||||
public:
|
||||
CString m_strCfgFilePath;
|
||||
CString m_strDataPath;
|
||||
CYoloV4 m_yoloV4;
|
||||
HWND m_hMainWnd;
|
||||
// <20><>д
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
CString SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param);
|
||||
|
||||
|
||||
// ʵ<><CAB5>
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CFastApp theApp;
|
||||
extern CCEXPipeClientBase* g_pstPipeClient;
|
||||
230
Plugin/Fast/Fast.vcxproj
Normal file
230
Plugin/Fast/Fast.vcxproj
Normal file
@@ -0,0 +1,230 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>Fast</ProjectName>
|
||||
<ProjectGuid>{EDB92B51-C3C2-44DA-B21D-6BB824264D08}</ProjectGuid>
|
||||
<RootNamespace>GrabImage_Display</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>14.0.23107.0</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Agv</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Agv</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>MvCameraControl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(MVCAM_COMMON_RUNENV)\Libraries\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\opencv\inc;$(SolutionDir)3rdparty\yolo4\inc;$(SolutionDir)3rdparty\hikvision\rgbd_camera\inc;$(SolutionDir)3rdparty\dahua\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opencv_calib3d454d.lib;opencv_core454d.lib;opencv_dnn454d.lib;opencv_features2d454d.lib;opencv_flann454d.lib;opencv_highgui454d.lib;opencv_imgcodecs454d.lib;opencv_imgproc454d.lib;opencv_ml454d.lib;opencv_video454d.lib;opencv_videoio454d.lib;opencv_face454d.lib;opencv_objdetect454d.lib;opencv_photo454d.lib;yolo_dll_cpud.lib;GdiPlus.lib;Mv3dRgbd.lib;opengl32.lib;glu32.lib;glfw3.lib;dhconfigsdk.lib;dhnetsdk.lib;dhplay.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\3rdparty\opencv\lib;$(SolutionDir)\3rdparty\yolo4\lib;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)\3rdparty\hikvision\rgbd_camera\lib\x64;$(SolutionDir)\3rdparty\dahua\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(MVCAM_COMMON_RUNENV)\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>MvCameraControl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(MVCAM_COMMON_RUNENV)\Libraries\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\opencv\inc;$(SolutionDir)3rdparty\yolo4\inc;$(SolutionDir)3rdparty\hikvision\rgbd_camera\inc;$(SolutionDir)3rdparty\dahua\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opencv_calib3d454.lib;opencv_core454.lib;opencv_dnn454.lib;opencv_features2d454.lib;opencv_flann454.lib;opencv_highgui454.lib;opencv_imgcodecs454.lib;opencv_imgproc454.lib;opencv_ml454.lib;opencv_video454.lib;opencv_videoio454.lib;opencv_face454.lib;opencv_objdetect454.lib;opencv_photo454.lib;yolo_dll_cpu.lib;GdiPlus.lib;Mv3dRgbd.lib;opengl32.lib;glu32.lib;glfw3.lib;dhconfigsdk.lib;dhnetsdk.lib;dhplay.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\3rdparty\yolo4\lib;$(SolutionDir)\3rdparty\opencv\lib;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)\3rdparty\hikvision\rgbd_camera\lib\x64;$(SolutionDir)\3rdparty\dahua\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_reader.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_value.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_writer.cpp" />
|
||||
<ClCompile Include="BaseCamera.cpp" />
|
||||
<ClCompile Include="DahuaFisheyeCamera.cpp" />
|
||||
<ClCompile Include="FastMainDialog.cpp" />
|
||||
<ClCompile Include="FastView.cpp" />
|
||||
<ClCompile Include="HikRgdbCamera.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="Fast.cpp" />
|
||||
<ClCompile Include="YoloV4.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BaseCamera.h" />
|
||||
<ClInclude Include="DahuaFisheyeCamera.h" />
|
||||
<ClInclude Include="FastMainDialog.h" />
|
||||
<ClInclude Include="FastView.h" />
|
||||
<ClInclude Include="HikRgdbCamera.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="Fast.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="YoloV4.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Fast.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\fast.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="Fast.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
45
Plugin/Fast/Fast.vcxproj.filters
Normal file
45
Plugin/Fast/Fast.vcxproj.filters
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FastMainDialog.cpp" />
|
||||
<ClCompile Include="FastView.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="Fast.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_reader.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_value.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_writer.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="YoloV4.cpp" />
|
||||
<ClCompile Include="BaseCamera.cpp" />
|
||||
<ClCompile Include="HikRgdbCamera.cpp" />
|
||||
<ClCompile Include="DahuaFisheyeCamera.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FastMainDialog.h" />
|
||||
<ClInclude Include="FastView.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="Fast.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="YoloV4.h" />
|
||||
<ClInclude Include="BaseCamera.h" />
|
||||
<ClInclude Include="HikRgdbCamera.h" />
|
||||
<ClInclude Include="DahuaFisheyeCamera.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Fast.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="json">
|
||||
<UniqueIdentifier>{9b459857-43fd-4c3e-9f43-f0d28d5146bb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\fast.ico" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
193
Plugin/Fast/FastMainDialog.cpp
Normal file
193
Plugin/Fast/FastMainDialog.cpp
Normal file
@@ -0,0 +1,193 @@
|
||||
// WcsMainDialog.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
#include "Fast.h"
|
||||
#include "FastMainDialog.h"
|
||||
|
||||
|
||||
|
||||
// CMainDialog <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CFastMainDialog, CDialogEx)
|
||||
|
||||
CFastMainDialog::CFastMainDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(IDD_FAST_MAIN_DIALOG, pParent)
|
||||
{
|
||||
}
|
||||
|
||||
CFastMainDialog::~CFastMainDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFastMainDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_STATIC_FAST1, m_FastCam[0]);
|
||||
DDX_Control(pDX, IDC_STATIC_FAST2, m_FastCam[1]);
|
||||
DDX_Control(pDX, IDC_STATIC_FAST3, m_FastCam[2]);
|
||||
DDX_Control(pDX, IDC_STATIC_FAST4, m_FastCam[3]);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFastMainDialog, CDialogEx)
|
||||
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CMainDialog <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//<2F><>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<CDA8>Ĺܵ<C4B9><DCB5>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void g_PipeCallBack(void* pObj, int lMsgId, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
CFastMainDialog* pModule = (CFastMainDialog*)pObj;
|
||||
if (CEXPIPE_CONNECT_OK == lMsgId)
|
||||
{
|
||||
//<2F><><EFBFBD>ӳɹ<D3B3>
|
||||
//if (FALSE == pModule->PostMessage(WM_PLATFORM_CONNECT_OK, NULL, NULL)) { LogOutToFile("g_PipeCallBack PostMessage error[%d]", lMsgId); }
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̹ܵ<EFBFBD>");
|
||||
|
||||
//<2F><>WMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
theApp.SendMsg2Platform("WMS", DEVICE_CONFIG_REQ, NULL);
|
||||
}
|
||||
else if (CEXPIPE_DIS_CLIENT == lMsgId)
|
||||
{
|
||||
//<2F>ܵ<EFBFBD><DCB5>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifndef _DEBUG
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹܵ<EFBFBD><EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>˳<EFBFBD>");
|
||||
//if (FALSE == pModule->PostMessage(WM_CLOSE, NULL, NULL)) { LogOutToFile("g_PipeCallBack PostMessage error[%d]", lMsgId); }
|
||||
pModule->PostMessage(WM_COMMAND, MAKEWPARAM(ID_TRAY_EXIT, 0), 0);
|
||||
#endif
|
||||
}
|
||||
else if (CEXPIPE_NEW_DATA == lMsgId)
|
||||
{
|
||||
pModule->ProcessPipeMsg(lMsgId, (char*)wparam, (int)lparam);
|
||||
}
|
||||
else
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFastMainDialog::ProcessPipeMsg(int lMsgId, char* pData, int lLen)
|
||||
{
|
||||
if (lLen == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PIPE_DATA_STRUCT* pstData = (PIPE_DATA_STRUCT*)pData;
|
||||
|
||||
//ƽ̨ת<CCA8><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
if (pstData->lMsgId == MAIN_2_MODULE_WMS && pstData->lDataLen > 0)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value root;
|
||||
if (reader.parse((char*)pstData->acData, root))
|
||||
{
|
||||
CString strReceiver = root["receiver"].asString().c_str();
|
||||
CString strSender = root["sender"].asString().c_str();
|
||||
int nMsgType = root["type"].asInt();
|
||||
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
/*if (nMsgType == DEVICE_CONFIG_RET)
|
||||
{
|
||||
|
||||
}
|
||||
else if (nMsgType == SET_TRANS_MODE_REQ && m_bDeviceInit) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵĹ<DFB5><C4B9><EFBFBD>ģʽ
|
||||
{
|
||||
|
||||
}
|
||||
else if (nMsgType == GET_TRANS_STATE_REQ)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
else if (pstData->lMsgId == MAIN_2_MODULE_SHOWWINDOW)
|
||||
{
|
||||
//PostMessage(WM_COMMAND, MAKEWPARAM(ID_TRAY_SHOW, 0), 0);
|
||||
AfxGetApp()->m_pMainWnd->ShowWindow(SW_SHOWNORMAL);
|
||||
SetForegroundWindow();
|
||||
}
|
||||
|
||||
LogOutToFile("HttpServiceListener::OnRecvRequest End");
|
||||
}
|
||||
|
||||
|
||||
BOOL CFastMainDialog::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
|
||||
theApp.m_hMainWnd = m_hWnd;
|
||||
//SetTimer(1, 500, NULL);
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
InitLocalCamera();
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL CFastMainDialog::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if (pMsg->message == WM_KEYDOWN&&pMsg->wParam == VK_RETURN)
|
||||
return TRUE;
|
||||
if (pMsg->message == WM_KEYDOWN&&pMsg->wParam == VK_ESCAPE)
|
||||
return TRUE;
|
||||
|
||||
return CDialog::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CFastMainDialog::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
||||
CDialogEx::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
void CFastMainDialog::InitLocalCamera()
|
||||
{
|
||||
m_FastCam[0].SetCameraInfo(0, HIK_RGBD, SNAP_PICTURE);
|
||||
m_FastCam[1].SetCameraInfo(1, DAHUA_FISHEYE, SNAP_PICTURE, "192.168.0.124", 37777);
|
||||
m_FastCam[2].SetCameraInfo(2, DAHUA_FISHEYE, RT_STREAMING, "192.168.0.124", 37777);
|
||||
}
|
||||
|
||||
/*
|
||||
void CFastMainDialog::InitCamereSDK()
|
||||
{
|
||||
MV3D_RGBD_VERSION_INFO stVersion;
|
||||
MV3D_RGBD_GetSDKVersion(&stVersion);
|
||||
MV3D_RGBD_Initialize();
|
||||
int ret = MV3D_RGBD_Initialize();
|
||||
|
||||
unsigned int nDevNum = 0;
|
||||
ret = MV3D_RGBD_GetDeviceNumber(DeviceType_USB, &nDevNum);
|
||||
|
||||
if (0 == nDevNum)
|
||||
{
|
||||
//AfxMessageBox("δ<><CEB4><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>.");
|
||||
return ;
|
||||
}
|
||||
|
||||
MV3D_RGBD_DEVICE_INFO info;
|
||||
for (int i = 0; i < nDevNum; i++)
|
||||
{
|
||||
m_CameraDev.push_back(info);
|
||||
}
|
||||
ret = MV3D_RGBD_GetDeviceList(DeviceType_USB, &m_CameraDev[0], nDevNum, &nDevNum);
|
||||
}
|
||||
*/
|
||||
38
Plugin/Fast/FastMainDialog.h
Normal file
38
Plugin/Fast/FastMainDialog.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
#include "afxwin.h"
|
||||
#include "FastView.h"
|
||||
|
||||
|
||||
|
||||
class CFastMainDialog : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CFastMainDialog)
|
||||
|
||||
public:
|
||||
CFastMainDialog(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CFastMainDialog();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_MAIN_DIALOG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
void InitLocalCamera();
|
||||
|
||||
public:
|
||||
|
||||
CFastView m_FastCam[4];
|
||||
std::vector<MV3D_RGBD_DEVICE_INFO> m_CameraDev;
|
||||
|
||||
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
void ProcessPipeMsg(int lMsgId, char* pData, int lLen);
|
||||
};
|
||||
398
Plugin/Fast/FastView.cpp
Normal file
398
Plugin/Fast/FastView.cpp
Normal file
@@ -0,0 +1,398 @@
|
||||
// PictureView.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
#include "FastView.h"
|
||||
#include "DahuaFisheyeCamera.h"
|
||||
#include "HikRgdbCamera.h"
|
||||
|
||||
//ͼ<><CDBC><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum
|
||||
{
|
||||
IMG_SIZE_NORMAL, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD>߾<EFBFBD><DFBE>ڻ<EFBFBD>ͼ<EFBFBD><CDBC>Χ<EFBFBD><CEA7>
|
||||
IMG_SIZE_WIDTH_BEYOND, //<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Χ
|
||||
IMG_SIZE_HEIGHT_BEYOND, //<2F><>ͼ<EFBFBD><CDBC><EFBFBD>߶ȳ<DFB6><C8B3><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Χ
|
||||
IMG_SIZE_BOTH_BEYOND //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD>߾<EFBFBD><DFBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Χ
|
||||
};
|
||||
// CPictureView
|
||||
|
||||
IMPLEMENT_DYNAMIC(CFastView, CStatic)
|
||||
|
||||
CFastView::CFastView()
|
||||
{
|
||||
m_pCameraDlg = NULL;
|
||||
}
|
||||
|
||||
CFastView::~CFastView()
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFastView, CStatic)
|
||||
ON_WM_PAINT()
|
||||
ON_WM_SIZE()
|
||||
ON_WM_CTLCOLOR()
|
||||
ON_WM_RBUTTONUP()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
||||
// CPictureView <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CFastView::StartPlay(CString strFile)
|
||||
{
|
||||
StopPlay();
|
||||
m_Image.Destroy();
|
||||
ShowWindow(SW_SHOW);
|
||||
if (0 == strFile.GetLength())
|
||||
return;
|
||||
|
||||
m_Image.Load(strFile); //<2F><><EFBFBD><EFBFBD>ͼƬ·<C6AC><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
|
||||
DrawPicture();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CFastView::StopPlay()
|
||||
{
|
||||
m_Image.Destroy();
|
||||
UpdateWindow();
|
||||
ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
|
||||
void CFastView::CalculateImageRect()
|
||||
{ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰͼ<C7B0><CDBC>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>
|
||||
if (m_Image.IsNull())
|
||||
return;
|
||||
|
||||
CRect rectWnd;
|
||||
GetWindowRect(&rectWnd);
|
||||
int MemWidth = rectWnd.Width();
|
||||
int MemHeight = rectWnd.Height();
|
||||
|
||||
//m_ImageRect = CRect(0, 0, MemWidth, MemHeight); //ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//return;
|
||||
|
||||
//<2F><>ȡͼ<C8A1><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CRect rectImg = CRect(0, 0, m_Image.GetWidth(), m_Image.GetHeight());
|
||||
|
||||
int ImgWidth = rectImg.Width();
|
||||
int ImgHeight = rectImg.Height();
|
||||
int nImgSizeType; //ͼ<><CDBC><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>ͶӰ<CDB6><D3B0><EFBFBD><EFBFBD>
|
||||
int nGap = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1>ǰͼ<C7B0><CDBC><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD><EFBFBD><EFBFBD>
|
||||
if ((ImgWidth <= MemWidth - nGap) && (ImgHeight <= MemHeight - nGap))
|
||||
nImgSizeType = IMG_SIZE_NORMAL;
|
||||
else if ((ImgWidth>MemWidth - nGap) && (ImgHeight <= MemHeight - nGap))
|
||||
nImgSizeType = IMG_SIZE_WIDTH_BEYOND;
|
||||
else if ((ImgWidth <= MemWidth - nGap) && (ImgHeight>MemHeight - nGap))
|
||||
nImgSizeType = IMG_SIZE_HEIGHT_BEYOND;
|
||||
else
|
||||
nImgSizeType = IMG_SIZE_BOTH_BEYOND;
|
||||
|
||||
//<2F>Բ<EFBFBD>ͬ<EFBFBD><CDAC>ͼ<EFBFBD><CDBC><EFBFBD>ߴ磬<DFB4><E7A3AC><EFBFBD><EFBFBD>ͶӰ<CDB6><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
switch (nImgSizeType)
|
||||
{
|
||||
float fScaleW, fScaleH; //X<><58>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>
|
||||
int nW, nH;
|
||||
//ֻ<>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ
|
||||
case IMG_SIZE_WIDTH_BEYOND:
|
||||
fScaleW = ((double)MemWidth) / ImgWidth;
|
||||
nW = MemWidth;
|
||||
nH = fScaleW*ImgHeight;
|
||||
m_ImageRect = CRect((MemWidth - nW) / 2 + nGap,
|
||||
(MemHeight - nH) / 2,
|
||||
(MemWidth + nW) / 2 - nGap,
|
||||
(MemHeight + nH) / 2);
|
||||
break;
|
||||
//ֻ<>и߳<D0B8><DFB3><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ
|
||||
case IMG_SIZE_HEIGHT_BEYOND:
|
||||
fScaleH = ((double)MemHeight) / ImgHeight;
|
||||
nW = fScaleH*ImgWidth;
|
||||
nH = MemHeight;
|
||||
m_ImageRect = CRect((MemWidth - nW) / 2,
|
||||
(MemHeight - nH) / 2 + nGap,
|
||||
(MemWidth + nW) / 2,
|
||||
(MemHeight + nH) / 2 - nGap);
|
||||
break;
|
||||
//<2F><><EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ<EFBFBD><CEA7>
|
||||
case IMG_SIZE_BOTH_BEYOND:
|
||||
case IMG_SIZE_NORMAL:
|
||||
fScaleW = ((double)MemWidth) / ImgWidth;
|
||||
fScaleH = ((double)MemHeight) / ImgHeight;
|
||||
float fScale = min(fScaleW, fScaleH);
|
||||
nW = fScale*ImgWidth;
|
||||
nH = fScale*ImgHeight;
|
||||
m_ImageRect = CRect((MemWidth - nW) / 2 + nGap,
|
||||
(MemHeight - nH) / 2 + nGap,
|
||||
(MemWidth + nW) / 2 - nGap,
|
||||
(MemHeight + nH) / 2 - nGap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CFastView::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><>Ϊ<EFBFBD><CEAA>ͼ<EFBFBD><CDBC>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> CStatic::OnPaint()
|
||||
if (FALSE == m_Image.IsNull())
|
||||
{
|
||||
CDC *pDC = GetDC();//<2F><><EFBFBD><EFBFBD>pictrue<75>ؼ<EFBFBD><D8BC><EFBFBD>DC
|
||||
//<2F><><EFBFBD><EFBFBD>CIMage<67><65><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SetStretchBltMode(pDC->m_hDC, HALFTONE);
|
||||
SetBrushOrgEx(pDC->m_hDC, 0, 0, NULL);
|
||||
|
||||
|
||||
CRect rectWnd = { 0 };
|
||||
GetWindowRect(&rectWnd);
|
||||
//<2F>ػ<EFBFBD><D8BB><EFBFBD>ɫ
|
||||
pDC->FillSolidRect(CRect(0, 0, rectWnd.Width(), rectWnd.Height()), RGB(0, 0, 0));
|
||||
//m_Image.StretchBlt(pDC->GetSafeHdc(), m_ImageRect, CRect(0, 0, m_Image.GetWidth(), m_Image.GetHeight()));
|
||||
m_Image.Draw(pDC->m_hDC, m_ImageRect); //<2F><>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>Picture<72>ؼ<EFBFBD><D8BC><EFBFBD>ʾ<EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ReleaseDC(pDC);//<2F>ͷ<EFBFBD>picture<72>ؼ<EFBFBD><D8BC><EFBFBD>DC
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFastView::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CStatic::OnSize(nType, cx, cy);
|
||||
DrawPicture();
|
||||
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
|
||||
void CFastView::DrawPicture()
|
||||
{
|
||||
if (FALSE == m_Image.IsNull())
|
||||
{
|
||||
CalculateImageRect();
|
||||
|
||||
if (m_ImageRect.Width() <= 0)
|
||||
return;
|
||||
|
||||
CDC *pDC = GetDC();//<2F><><EFBFBD><EFBFBD>pictrue<75>ؼ<EFBFBD><D8BC><EFBFBD>DC
|
||||
CRect rectWnd;
|
||||
GetWindowRect(&rectWnd);
|
||||
|
||||
//<2F>ػ<EFBFBD><D8BB><EFBFBD>ɫ
|
||||
//pDC->FillSolidRect(CRect(0, 0, rectWnd.Width(), rectWnd.Height()), RGB(0, 0, 0));
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>CIMage<67><65><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//SetStretchBltMode(pDC->m_hDC, HALFTONE);
|
||||
//SetBrushOrgEx(pDC->m_hDC, 0, 0, NULL);
|
||||
SetStretchBltMode(pDC->m_hDC, COLORONCOLOR);
|
||||
SetBrushOrgEx(pDC->m_hDC, 0, 0, NULL);
|
||||
//dc.SetStretchBltMode
|
||||
|
||||
//m_Image.StretchBlt(pDC->GetSafeHdc(), CRect(0, 0, m_Image.GetWidth(), m_Image.GetHeight()), m_ImageRect);
|
||||
|
||||
|
||||
m_Image.Draw(pDC->GetSafeHdc(), m_ImageRect); //<2F><>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>Picture<72>ؼ<EFBFBD><D8BC><EFBFBD>ʾ<EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ReleaseDC(pDC);//<2F>ͷ<EFBFBD>picture<72>ؼ<EFBFBD><D8BC><EFBFBD>DC
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HBRUSH CFastView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
||||
{
|
||||
HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);
|
||||
|
||||
CBrush brush;
|
||||
brush.CreateSolidBrush(RGB(0, 0, 0));
|
||||
|
||||
// TODO: <20>ڴ˸<DAB4><CBB8><EFBFBD> DC <20><><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD>
|
||||
pDC->SetBkColor(RGB(0, 0, 0));
|
||||
return (HBRUSH)brush;
|
||||
|
||||
// TODO: <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵIJ<CFB5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>軭<EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><F2B7B5BB><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
return hbr;
|
||||
}
|
||||
|
||||
UINT CFastView::CameraThreadFunc(PVOID pv)
|
||||
{
|
||||
//ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>Ϊÿ<CEAA><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
|
||||
ST_THREAD_PARAM *pParam = (ST_THREAD_PARAM *)pv;
|
||||
CFastView *pThis = (CFastView*)pParam->pParent;
|
||||
int nIdx = pParam->nIdx;
|
||||
delete pv;
|
||||
|
||||
if (pThis->m_nCameraTyp == HIK_RGBD)
|
||||
{
|
||||
pThis->m_pCameraDlg = new CHikRgdbCamera(pThis, nIdx);
|
||||
pThis->m_pCameraDlg->Create(IDD_DLG_CAM);
|
||||
pThis->m_pCameraDlg->ShowWindow(SW_HIDE);
|
||||
}
|
||||
else if (pThis->m_nCameraTyp == DAHUA_FISHEYE)
|
||||
{
|
||||
pThis->m_pCameraDlg = new CDahuaFisheyeCamera(pThis, nIdx, pThis->m_nPlayTyp);
|
||||
pThis->m_pCameraDlg->Create(IDD_DLG_CAM);
|
||||
pThis->m_pCameraDlg->ShowWindow(SW_HIDE);
|
||||
}
|
||||
|
||||
/*else if (pThis->m_nCameraTyp == DAHUA_FISHEYE_LIVE)
|
||||
{
|
||||
pThis->m_pCameraDlg = new CDahuaFisheyeLiveCamera(pThis, nIdx);
|
||||
pThis->m_pCameraDlg->Create(IDD_DLG_CAM);
|
||||
pThis->m_pCameraDlg->ShowWindow(SW_HIDE);
|
||||
}*/
|
||||
|
||||
//The message loop
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
pThis->m_pCameraDlg->DestroyWindow();
|
||||
delete pThis->m_pCameraDlg;
|
||||
|
||||
TRACE(_T("<EFBFBD>ͷŶԻ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CFastView::SetCameraInfo(int nIdx, ENUM_CAMERA_TYPE enCameraType, ENUM_PLAY_TYPE enPlayType, String strIp, int nPort)
|
||||
{
|
||||
m_nCameraIdx = nIdx;
|
||||
m_nCameraTyp = enCameraType;
|
||||
m_nPlayTyp = enPlayType;
|
||||
|
||||
ST_THREAD_PARAM *pParam = new ST_THREAD_PARAM;
|
||||
pParam->nIdx = nIdx;
|
||||
pParam->pParent = this;
|
||||
AfxBeginThread(CFastView::CameraThreadFunc, (void*)pParam);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CFastView::OnRButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
CMenu menu;
|
||||
menu.CreatePopupMenu();
|
||||
//<2F><><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>Dz˵<C7B2><CBB5><EFBFBD>
|
||||
menu.AppendMenu(MF_STRING, ID_MRU_SAMPLE, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
//menu.AppendMenu(MF_STRING, WM TEST2, "Test item 2");
|
||||
//menu.AppendMenu(MF_STRING, WM TEST3, "Test item 3");
|
||||
//menu.AppendMenu(MF_STRING, WM TEST4, "Test item 4");
|
||||
//<2F><><EFBFBD>һ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD>·<EFBFBD>20<32><30><EFBFBD>صĵط<C4B5><D8B7><EFBFBD>ʾ<EFBFBD>˵<EFBFBD>
|
||||
POINT tpoint;
|
||||
tpoint.x = point.x;
|
||||
tpoint.y = point.y;
|
||||
|
||||
ClientToScreen(&tpoint);
|
||||
menu.TrackPopupMenu(TPM_LEFTALIGN, tpoint.x, tpoint.y + 20, this);
|
||||
|
||||
CStatic::OnRButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
BOOL CFastView::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ר<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case ID_MRU_SAMPLE:
|
||||
{
|
||||
/*CString strMsg;
|
||||
strMsg.Format("<22><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ%d<><64><EFBFBD><EFBFBD>", m_nCameraIndex);
|
||||
AfxMessageBox(strMsg);*/
|
||||
if (NULL != m_pCameraDlg)
|
||||
{
|
||||
::PostMessage(m_pCameraDlg->m_hWnd, WM_CAMERA_SNAP, NULL, NULL);
|
||||
}
|
||||
//((CMainFrame*)GetParentFrame())->BeginSample(m_nCameraIndex);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return CStatic::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>1<EFBFBD><31>opencv<63><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
||||
//<2F><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>Ҫչʾ<D5B9><CABE>Picture Control<6F><6C>ID
|
||||
void CFastView::DrawMat(cv::Mat& imageMat, int nOffset)
|
||||
{
|
||||
/*cv::Mat img;
|
||||
|
||||
int nWidth = imageMat.cols * rect.Height() *1.0 / imageMat.rows;
|
||||
cv::resize(imageMat, img, cv::Size(nWidth, rect.Height()));// <20><><EFBFBD><EFBFBD>Mat<61><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// תһ<D7AA>¸<EFBFBD>ʽ ,<2C><><EFBFBD>ο<EFBFBD><CEBF>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD>,*/
|
||||
|
||||
/*switch (imgTmp.channels())
|
||||
{
|
||||
case 1:
|
||||
cv::cvtColor(imgTmp, imgTmp, CV_GRAY2BGRA); // GRAY<41><59>ͨ<EFBFBD><CDA8>
|
||||
break;
|
||||
case 3:
|
||||
cv::cvtColor(imgTmp, imgTmp, CV_BGR2BGRA); // BGR<47><52>ͨ<EFBFBD><CDA8>
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int pixelBytes = imgTmp.channels() * (imgTmp.depth() + 1); // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6>ٸ<EFBFBD><D9B8>ֽ<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD>bitmapinfo(<28><><EFBFBD><EFBFBD>ͷ)
|
||||
BITMAPINFO bitInfo;
|
||||
bitInfo.bmiHeader.biBitCount = 8 * pixelBytes;
|
||||
bitInfo.bmiHeader.biWidth = imgTmp.cols;
|
||||
bitInfo.bmiHeader.biHeight = -imgTmp.rows;
|
||||
bitInfo.bmiHeader.biPlanes = 1;
|
||||
bitInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitInfo.bmiHeader.biClrImportant = 0;
|
||||
bitInfo.bmiHeader.biClrUsed = 0;
|
||||
bitInfo.bmiHeader.biSizeImage = 0;
|
||||
bitInfo.bmiHeader.biXPelsPerMeter = 0;
|
||||
bitInfo.bmiHeader.biYPelsPerMeter = 0;
|
||||
// Mat.data + bitmap<61><70><EFBFBD><EFBFBD>ͷ -> MFC
|
||||
CDC* pDC = GetDC();
|
||||
::StretchDIBits(
|
||||
pDC->GetSafeHdc(),
|
||||
(rect.Width()-nWidth)/2, 0, nWidth, rect.Height(),
|
||||
0, 0, nWidth, rect.Height(),
|
||||
imgTmp.data,
|
||||
&bitInfo,
|
||||
DIB_RGB_COLORS,
|
||||
SRCCOPY
|
||||
);
|
||||
ReleaseDC(pDC);*/
|
||||
|
||||
CImage image;
|
||||
image.Create(imageMat.cols, imageMat.rows, 24);
|
||||
for (int y = 0; y < imageMat.rows; ++y) {
|
||||
const uchar* src = imageMat.ptr<uchar>(y);
|
||||
uchar* dst = reinterpret_cast<uchar*>(image.GetBits()) + y * image.GetPitch();
|
||||
for (int x = 0; x < imageMat.cols; ++x) {
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
src += 3;
|
||||
dst += 3;
|
||||
}
|
||||
}
|
||||
|
||||
HDC hdc = ::GetDC(m_hWnd);
|
||||
|
||||
CRect rect;
|
||||
GetClientRect(&rect); // <20><>ȡ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>С
|
||||
image.Draw(hdc, rect);
|
||||
image.Destroy();
|
||||
::ReleaseDC(m_hWnd, hdc);
|
||||
|
||||
}
|
||||
|
||||
47
Plugin/Fast/FastView.h
Normal file
47
Plugin/Fast/FastView.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CFastView
|
||||
class CBaseCamera;
|
||||
class CFastView : public CStatic
|
||||
{
|
||||
DECLARE_DYNAMIC(CFastView)
|
||||
|
||||
public:
|
||||
CFastView();
|
||||
virtual ~CFastView();
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
void StartPlay(CString strFile);
|
||||
void StopPlay();
|
||||
void DrawPicture();
|
||||
void CalculateImageRect();
|
||||
CImage m_Image; //<2F><><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC>
|
||||
CRect m_ImageRect;
|
||||
CBrush m_bkBrush;
|
||||
|
||||
public:
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
||||
|
||||
|
||||
public:
|
||||
void SetCameraInfo(int nIdx, ENUM_CAMERA_TYPE, ENUM_PLAY_TYPE, String strIp = "", int nPort = 0);
|
||||
void DrawMat(cv::Mat& imageMat, int nOffset);
|
||||
static UINT CameraThreadFunc(PVOID pv);
|
||||
CBaseCamera *m_pCameraDlg;
|
||||
int m_nCameraIdx;
|
||||
ENUM_CAMERA_TYPE m_nCameraTyp;
|
||||
ENUM_PLAY_TYPE m_nPlayTyp;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
295
Plugin/Fast/HikRgdbCamera.cpp
Normal file
295
Plugin/Fast/HikRgdbCamera.cpp
Normal file
@@ -0,0 +1,295 @@
|
||||
// MsgHandleDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Fast.h"
|
||||
#include "HikRgdbCamera.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "FastView.h"
|
||||
#include "RenderImage.hpp"
|
||||
|
||||
|
||||
|
||||
#define IMAGE_W 1280
|
||||
#define IMAGE_H 720
|
||||
char rgb24[IMAGE_W * IMAGE_H * 3];
|
||||
|
||||
|
||||
#define TIMER_LOGIN 10
|
||||
|
||||
|
||||
// CMsgHandleDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CHikRgdbCamera, CBaseCamera)
|
||||
|
||||
CHikRgdbCamera::CHikRgdbCamera(CFastView * pParentWnd, int nIdx, CWnd* pParent /*=NULL*/)
|
||||
: CBaseCamera(IDD_DLG_CAM, pParentWnd)
|
||||
{
|
||||
m_nCameraIdx = nIdx;
|
||||
m_pParentWnd = pParentWnd;
|
||||
m_hCameraHandle = NULL;
|
||||
}
|
||||
|
||||
CHikRgdbCamera::~CHikRgdbCamera()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CHikRgdbCamera::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CHikRgdbCamera, CDialog)
|
||||
ON_WM_DESTROY()
|
||||
ON_WM_TIMER()
|
||||
ON_MESSAGE(WM_CAMERA_SNAP, &CHikRgdbCamera::OnSnap)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
||||
short CHikRgdbCamera::GetPointDepth(unsigned char * pSrcData, int x, int y)
|
||||
{
|
||||
if (nullptr == pSrcData)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int nDepth = 0;
|
||||
int nMax = INT_MIN;
|
||||
int nMin = INT_MAX;
|
||||
|
||||
short* pValue = (short*)pSrcData;
|
||||
|
||||
if (C16_INVALID_VALUE == nDepth)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pValue[y * IMAGE_W + x];
|
||||
}
|
||||
|
||||
short CHikRgdbCamera::GeRectDepth(unsigned char * pSrcData, cv::Point2f lt, cv::Point2f rb)
|
||||
{
|
||||
int nMin = 999999;
|
||||
for (int i = lt.x; i < rb.x; i++)
|
||||
{
|
||||
for (int j = lt.y; j < rb.y; j++)
|
||||
{
|
||||
int depth = GetPointDepth(pSrcData, i, j);
|
||||
if (depth < nMin && depth > 0)
|
||||
{
|
||||
nMin = depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nMin;
|
||||
}
|
||||
|
||||
|
||||
// CMsgHandleDlg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
BOOL CHikRgdbCamera::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
InitCameraSDK();
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
|
||||
BOOL CHikRgdbCamera::InitCameraSDK()
|
||||
{
|
||||
|
||||
MV3D_RGBD_VERSION_INFO stVersion;
|
||||
MV3D_RGBD_GetSDKVersion(&stVersion);
|
||||
MV3D_RGBD_Initialize();
|
||||
int ret = MV3D_RGBD_Initialize();
|
||||
|
||||
unsigned int nDevNum = 0;
|
||||
ret = MV3D_RGBD_GetDeviceNumber(DeviceType_USB, &nDevNum);
|
||||
|
||||
if (0 == nDevNum)
|
||||
{
|
||||
//AfxMessageBox("δ<><CEB4><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::vector<MV3D_RGBD_DEVICE_INFO> devs(nDevNum);
|
||||
ret = MV3D_RGBD_GetDeviceList(DeviceType_USB, &devs[0], nDevNum, &nDevNum);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>豸
|
||||
MV3D_RGBD_OpenDevice(&m_hCameraHandle, &devs[0]);
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MV3D_RGBD_Start(m_hCameraHandle);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
|
||||
|
||||
LRESULT CHikRgdbCamera::OnSnap(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
AfxMessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
MV3D_RGBD_FRAME_DATA stFrameData = { 0 };
|
||||
int nRet = MV3D_RGBD_FetchFrame(m_hCameraHandle, &stFrameData, 5000);
|
||||
CTime currentTime = CTime::GetCurrentTime(); // <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1>
|
||||
CString dateStr = currentTime.Format(_T("%Y_%m_%d")); // <20><>ʽ<EFBFBD><CABD>Ϊ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
CString tiemStr = currentTime.Format(_T("%H_%M_%S")); // <20><>ʽ<EFBFBD><CABD>Ϊ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
CString strPath = theApp.m_strDataPath + "\\" + dateStr;
|
||||
|
||||
if (MV3D_RGBD_OK == nRet)
|
||||
{
|
||||
if (!stFrameData.nValidInfo)
|
||||
{
|
||||
RIFrameInfo depth = { 0 };
|
||||
RIFrameInfo rgb = { 0 };
|
||||
RIFrameInfo rgbd = { 0 };
|
||||
parseFrame(&stFrameData, &depth, &rgb, &rgbd);
|
||||
|
||||
/*for (int i = 0; i < 20; i++)
|
||||
{
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
int nDepth = GeRectDepth(depth.pData, cv::Point2f(i * 64, j * 72), cv::Point2f((i + 1) * 64, (j + 1) * 72));
|
||||
char acDepth[32];
|
||||
sprintf(acDepth, "%d", nDepth);
|
||||
cv::rectangle(image, cv::Point2f(i * 64, j * 72), cv::Point2f((i + 1) * 64, (j + 1) * 72), cv::Scalar(5, 5, 2555), 1, 8, 0);
|
||||
cv::putText(image, acDepth, cv::Point2f(i * 64, j * 72 + 20), cv::FONT_HERSHEY_COMPLEX_SMALL, 1.0, cv::Scalar(5, 5, 255), 1);
|
||||
}
|
||||
}*/
|
||||
|
||||
if (!PathIsDirectory(strPath))//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
CreateDirectory(strPath, NULL);//<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
}
|
||||
|
||||
char acFileName[256] = "";
|
||||
sprintf(acFileName, "%s\\%s-%d.jpg", strPath, tiemStr, m_nCameraIdx);
|
||||
|
||||
vector<CRect> targetRects;
|
||||
cv::Mat image(IMAGE_H, IMAGE_W, CV_8UC3, rgb.pData); //bufferΪת<CEAA><D7AA><EFBFBD><EFBFBD>rgb<67><62><EFBFBD><EFBFBD>
|
||||
//ʶ<><CAB6>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
TargetDetection(m_nCameraIdx, image, targetRects);
|
||||
|
||||
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
targetRects.push_back(CRect(500, 400, 900, 600));
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cv::Point3f coordinate = cv::Point3f(0, 0, 99999);
|
||||
CRect rect;
|
||||
TargetPosition(depth.pData, targetRects, coordinate, rect);
|
||||
if (coordinate.z != 99999)
|
||||
{
|
||||
char acCoordinate[32];
|
||||
sprintf(acCoordinate, "x:%.0f, y:%.0f, z:%.0f", coordinate.x, coordinate.y, coordinate.z);
|
||||
cv::rectangle(image, cv::Point2f(rect.left, rect.top), cv::Point2f(rect.right, rect.bottom), cv::Scalar(5, 5, 2555), 1, 8, 0);
|
||||
cv::putText(image, acCoordinate, cv::Point2f(coordinate.x, coordinate.y), cv::FONT_HERSHEY_COMPLEX_SMALL, 1.0, cv::Scalar(5, 5, 255), 1);
|
||||
|
||||
|
||||
//m_pParentWnd->CameraSnapPicRet(acFileName, m_nCameraIdx, coordinate);
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
imwrite(acFileName, image);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
m_pParentWnd->StartPlay(acFileName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CHikRgdbCamera::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
||||
if (nIDEvent == TIMER_LOGIN)
|
||||
{
|
||||
//<2F>豸<EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
|
||||
}
|
||||
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
|
||||
void CHikRgdbCamera::OnDestroy()
|
||||
{
|
||||
CDialog::OnDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CHikRgdbCamera::TargetDetection(int nCameraIdx, cv::Mat &mat_img, vector<CRect> &findRects)
|
||||
{
|
||||
CRect findRect;
|
||||
try {
|
||||
cv::Mat dst = mat_img;
|
||||
//cv::Size newSize(mat_img.size().width / 4, mat_img.size().height / 4); // <20><><EFBFBD><EFBFBD><EFBFBD>µijߴ<C4B3>
|
||||
//cv::resize(mat_img, dst, newSize); // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ߴ<EFBFBD>
|
||||
|
||||
auto det_image = theApp.m_yoloV4.m_pDetector->mat_to_image_resize(dst);
|
||||
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
std::vector<bbox_t> result_vec = theApp.m_yoloV4.m_pDetector->detect_resized(*det_image, dst.size().width, dst.size().height);
|
||||
auto end = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> spent = end - start;
|
||||
std::cout << " Time: " << spent.count() << " sec \n";
|
||||
|
||||
theApp.m_yoloV4.DrawObjectBoxes(dst, result_vec, theApp.m_yoloV4.m_vObjects_Names);
|
||||
|
||||
for (int i = 0; i < result_vec.size(); i++)
|
||||
{
|
||||
bbox_t result_area = result_vec.at(i);
|
||||
std::string obj_name = theApp.m_yoloV4.m_vObjects_Names[result_area.obj_id];
|
||||
//if (result_area.prob >= 0.9 && (0 == obj_name.compare("up") ))
|
||||
{
|
||||
CRect rect;
|
||||
rect.left = result_area.x;
|
||||
rect.top = result_area.y;
|
||||
rect.right = result_area.x + result_area.w;
|
||||
rect.bottom = result_area.y + result_area.h;
|
||||
findRects.push_back(rect);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (std::exception &e) { std::cerr << "exception: " << e.what() << "\n"; getchar(); }
|
||||
catch (...) { std::cerr << "unknown exception \n"; getchar(); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CHikRgdbCamera::TargetPosition(unsigned char* pDepthData, vector<CRect> &findRects, cv::Point3f& coordinate, CRect& rect)
|
||||
{
|
||||
for (int i = 0; i < findRects.size(); i++)
|
||||
{
|
||||
CRect rt = findRects.at(i);
|
||||
|
||||
if (rt.Width() > rt.Height())
|
||||
{
|
||||
int x = (rt.left + rt.right) / 2;
|
||||
int y = (rt.top + rt.bottom) / 2;
|
||||
int z = GetPointDepth(pDepthData, x, y);
|
||||
|
||||
if (z < coordinate.z && z > 0)
|
||||
{
|
||||
coordinate = cv::Point3f(x, y, z);
|
||||
rect = rt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F><>ת90<39><30>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
41
Plugin/Fast/HikRgdbCamera.h
Normal file
41
Plugin/Fast/HikRgdbCamera.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseCamera.h"
|
||||
|
||||
class CFastView;
|
||||
class CHikRgdbCamera : public CBaseCamera
|
||||
{
|
||||
DECLARE_DYNAMIC(CHikRgdbCamera)
|
||||
|
||||
public:
|
||||
CHikRgdbCamera(CFastView *, int nIdx, CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CHikRgdbCamera();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_DLG_CAM};
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
CFastView *m_pParentWnd;
|
||||
void* m_hCameraHandle;
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg LRESULT OnSnap(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
BOOL InitCameraSDK();
|
||||
short GetPointDepth(unsigned char * pSrcData, int x, int y);
|
||||
short GeRectDepth(unsigned char * pSrcData, cv::Point2f lt, cv::Point2f rb);
|
||||
void TargetDetection(int nCameraIdx, cv::Mat &mat_img, vector<CRect> &findRects);
|
||||
void TargetPosition(unsigned char* pDepthData, vector<CRect> &findRects, cv::Point3f& coordinate, CRect& rect);
|
||||
|
||||
public:
|
||||
int m_nCameraIdx;
|
||||
|
||||
|
||||
};
|
||||
136
Plugin/Fast/YoloV4.cpp
Normal file
136
Plugin/Fast/YoloV4.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
|
||||
// Vcs-Client.cpp : <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "YoloV4.h"
|
||||
|
||||
CYoloV4::CYoloV4()
|
||||
{
|
||||
InitYoloV4();
|
||||
}
|
||||
|
||||
CYoloV4::~CYoloV4()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CYoloV4::InitYoloV4()
|
||||
{
|
||||
char path[1000];
|
||||
int filelen = GetModuleFileName(NULL, path, 1000);
|
||||
int i = filelen;
|
||||
while (path[i] != '\\')i--;
|
||||
path[i + 1] = '\0';
|
||||
CString strModulePath = path;
|
||||
|
||||
CString names_file = strModulePath + "\\yolov4-tiny\\vocbox.names";
|
||||
CString cfg_file = strModulePath + "\\yolov4-tiny\\yolov4-tiny-custom.cfg";
|
||||
CString weights_file = strModulePath + "\\yolov4-tiny\\yolov4-tiny-custom_last.weights";
|
||||
|
||||
m_pDetector = new Detector(cfg_file.GetBuffer(), weights_file.GetBuffer());
|
||||
m_vObjects_Names = ObjectsNamesFromFile(names_file);
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> CYoloV4::ObjectsNamesFromFile(CString strFilename)
|
||||
{
|
||||
int pos = 0;
|
||||
CStdioFile file;
|
||||
CString strText = _T("");
|
||||
std::vector<std::string> file_lines;
|
||||
|
||||
if (file.Open(strFilename, CFile::modeRead))
|
||||
{
|
||||
file.Seek(pos, CFile::begin);
|
||||
while (file.ReadString(strText))
|
||||
{
|
||||
pos = file.GetPosition();//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>;
|
||||
file_lines.push_back(strText.GetBuffer());
|
||||
}
|
||||
|
||||
file.Close();
|
||||
return file_lines;
|
||||
}
|
||||
}
|
||||
|
||||
void CYoloV4::DrawObjectBoxes(cv::Mat mat_img, std::vector<bbox_t> result_vec, std::vector<std::string> obj_names,
|
||||
int current_det_fps, int current_cap_fps)
|
||||
{
|
||||
int const colors[6][3] = { { 1,0,1 },{ 0,0,1 },{ 0,1,1 },{ 0,1,0 },{ 1,1,0 },{ 1,0,0 } };
|
||||
|
||||
for (auto &i : result_vec) {
|
||||
cv::Scalar color = obj_id_to_color(i.obj_id);
|
||||
cv::rectangle(mat_img, cv::Rect(i.x, i.y, i.w, i.h), color, 2);
|
||||
if (obj_names.size() > i.obj_id) {
|
||||
std::string obj_name = obj_names[i.obj_id];
|
||||
if (i.track_id > 0) obj_name += " - " + std::to_string(i.track_id);
|
||||
cv::Size const text_size = getTextSize(obj_name, cv::FONT_HERSHEY_COMPLEX_SMALL, 1.2, 2, 0);
|
||||
int max_width = (text_size.width > i.w + 2) ? text_size.width : (i.w + 2);
|
||||
max_width = std::max(max_width, (int)i.w + 2);
|
||||
//max_width = std::max(max_width, 283);
|
||||
std::string coords_3d;
|
||||
if (!std::isnan(i.z_3d)) {
|
||||
std::stringstream ss;
|
||||
ss << std::fixed << std::setprecision(2) << "x:" << i.x_3d << "m y:" << i.y_3d << "m z:" << i.z_3d << "m ";
|
||||
coords_3d = ss.str();
|
||||
cv::Size const text_size_3d = getTextSize(ss.str(), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, 1, 0);
|
||||
int const max_width_3d = (text_size_3d.width > i.w + 2) ? text_size_3d.width : (i.w + 2);
|
||||
if (max_width_3d > max_width) max_width = max_width_3d;
|
||||
}
|
||||
|
||||
cv::rectangle(mat_img, cv::Point2f(std::max((int)i.x - 1, 0), std::max((int)i.y - 65, 0)),
|
||||
cv::Point2f(std::min((int)i.x + max_width, mat_img.cols - 1), std::min((int)i.y, mat_img.rows - 1)),
|
||||
color, CV_FILLED, 8, 0);
|
||||
putText(mat_img, obj_name, cv::Point2f(i.x, i.y - 16), cv::FONT_HERSHEY_COMPLEX_SMALL, 1.6, cv::Scalar(0, 0, 0), 4);
|
||||
if (!coords_3d.empty()) putText(mat_img, coords_3d, cv::Point2f(i.x, i.y - 1), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(0, 0, 0), 1);
|
||||
}
|
||||
}
|
||||
if (current_det_fps >= 0 && current_cap_fps >= 0) {
|
||||
std::string fps_str = "FPS detection: " + std::to_string(current_det_fps) + " FPS capture: " + std::to_string(current_cap_fps);
|
||||
putText(mat_img, fps_str, cv::Point2f(10, 20), cv::FONT_HERSHEY_COMPLEX_SMALL, 1.2, cv::Scalar(50, 255, 0), 2);
|
||||
}
|
||||
}
|
||||
|
||||
void CYoloV4::TargetDetection(int nCameraIdx, cv::Mat &mat_img, vector<CRect> &findRects)
|
||||
{
|
||||
CRect findRect;
|
||||
try {
|
||||
cv::Mat dst = mat_img;
|
||||
//cv::Size newSize(mat_img.size().width / 4, mat_img.size().height / 4); // <20><><EFBFBD><EFBFBD><EFBFBD>µijߴ<C4B3>
|
||||
//cv::resize(mat_img, dst, newSize); // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ߴ<EFBFBD>
|
||||
|
||||
auto det_image = m_pDetector->mat_to_image_resize(dst);
|
||||
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
std::vector<bbox_t> result_vec = m_pDetector->detect_resized(*det_image, dst.size().width, dst.size().height);
|
||||
auto end = std::chrono::steady_clock::now();
|
||||
std::chrono::duration<double> spent = end - start;
|
||||
std::cout << " Time: " << spent.count() << " sec \n";
|
||||
|
||||
DrawObjectBoxes(dst, result_vec, m_vObjects_Names);
|
||||
|
||||
for (int i = 0; i < result_vec.size(); i++)
|
||||
{
|
||||
bbox_t result_area = result_vec.at(i);
|
||||
std::string obj_name = m_vObjects_Names[result_area.obj_id];
|
||||
//if (result_area.prob >= 0.9 && (0 == obj_name.compare("up") ))
|
||||
{
|
||||
CRect rect;
|
||||
rect.left = result_area.x;
|
||||
rect.top = result_area.y;
|
||||
rect.right = result_area.x + result_area.w;
|
||||
rect.bottom = result_area.y + result_area.h;
|
||||
findRects.push_back(rect);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (std::exception &e) { std::cerr << "exception: " << e.what() << "\n"; getchar(); }
|
||||
catch (...) { std::cerr << "unknown exception \n"; getchar(); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
23
Plugin/Fast/YoloV4.h
Normal file
23
Plugin/Fast/YoloV4.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
// CYoloV4
|
||||
#include "yolo_v2_class.hpp"
|
||||
|
||||
class CYoloV4
|
||||
{
|
||||
public:
|
||||
CYoloV4();
|
||||
virtual ~CYoloV4();
|
||||
void InitYoloV4();
|
||||
|
||||
public:
|
||||
|
||||
void DrawObjectBoxes(cv::Mat mat_img, std::vector<bbox_t> result_vec, std::vector<std::string> obj_names, int current_det_fps=-1, int current_cap_fps=-1);
|
||||
void TargetDetection(int nCameraIdx, cv::Mat &mat_img, vector<CRect> &findRects);
|
||||
std::vector<std::string> ObjectsNamesFromFile(CString strFilename);
|
||||
std::vector<std::string> m_vObjects_Names; //<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Detector *m_pDetector;
|
||||
|
||||
};
|
||||
|
||||
|
||||
BIN
Plugin/Fast/fast.rc
Normal file
BIN
Plugin/Fast/fast.rc
Normal file
Binary file not shown.
BIN
Plugin/Fast/res/fast.ico
Normal file
BIN
Plugin/Fast/res/fast.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
Plugin/Fast/res/fast.rc2
Normal file
BIN
Plugin/Fast/res/fast.rc2
Normal file
Binary file not shown.
BIN
Plugin/Fast/resource.h
Normal file
BIN
Plugin/Fast/resource.h
Normal file
Binary file not shown.
108
Plugin/Fast/stdafx.cpp
Normal file
108
Plugin/Fast/stdafx.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
// stdafx.cpp : ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Դ<EFBFBD>ļ<EFBFBD>
|
||||
// Vcs-Client.pch <20><><EFBFBD><EFBFBD>ΪԤ<CEAA><D4A4><EFBFBD><EFBFBD>ͷ
|
||||
// stdafx.obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
#define MIN_XYZ_VALUE (-999999)
|
||||
float* g_xys = new float[3000 * 3000 * 2];
|
||||
int g_xyz_flag = 0;
|
||||
|
||||
|
||||
#define Q_R 1500
|
||||
#define X0 1500
|
||||
#define Y0 1500
|
||||
|
||||
inline float abs_m(float lf)
|
||||
{
|
||||
if (lf < 0) lf *= -1;
|
||||
return lf;
|
||||
}
|
||||
|
||||
// <20><>cΪ<63><CEAA>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļн<C4BC>
|
||||
float getAngelOfTwoVector(Point2f &pt1, Point2f &pt2, Point2f &c)
|
||||
{
|
||||
float theta = atan2(pt1.y - c.y, pt1.x - c.x) - atan2(pt2.y - c.y, pt2.x - c.x);
|
||||
if (theta > CV_PI)
|
||||
theta -= 2 * CV_PI;
|
||||
if (theta < -CV_PI)
|
||||
theta += 2 * CV_PI;
|
||||
|
||||
theta = -1*theta * 180.0 / CV_PI;
|
||||
return theta;
|
||||
}
|
||||
|
||||
|
||||
//<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ָ<EFBFBD>
|
||||
void splitString(const string& s, vector<string>& v, const string& c)
|
||||
{
|
||||
string::size_type pos1, pos2;
|
||||
pos2 = s.find(c);
|
||||
pos1 = 0;
|
||||
while (string::npos != pos2)
|
||||
{
|
||||
v.push_back(s.substr(pos1, pos2 - pos1));
|
||||
pos1 = pos2 + c.size();
|
||||
pos2 = s.find(c, pos1);
|
||||
}
|
||||
if (pos1 != s.length())
|
||||
v.push_back(s.substr(pos1));
|
||||
}
|
||||
|
||||
CString g_strSavePath = "";
|
||||
CString g_strCurTime = "";
|
||||
|
||||
void LogOutToFile(const char* fmt, ...)
|
||||
{
|
||||
static CRITICAL_SECTION stCritical;
|
||||
static BOOL bInit = FALSE;
|
||||
static CString strLogPath;
|
||||
if (FALSE == bInit)
|
||||
{
|
||||
bInit = TRUE;
|
||||
GetModuleFileName(NULL, strLogPath.GetBuffer(2048), 2047);
|
||||
strLogPath.ReleaseBuffer();
|
||||
strLogPath = strLogPath.Left(strLogPath.ReverseFind('\\'));
|
||||
strLogPath += "\\log\\runtime.log";
|
||||
|
||||
InitializeCriticalSection(&stCritical);
|
||||
}
|
||||
|
||||
EnterCriticalSection(&stCritical);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
char pBuffer[800] = "";
|
||||
if (vsnprintf_s(pBuffer, 796, _TRUNCATE, fmt, ap) > 0)
|
||||
{
|
||||
|
||||
if (strlen(pBuffer) == 0 || pBuffer[strlen(pBuffer) - 1] != '\n')
|
||||
{
|
||||
pBuffer[strlen(pBuffer) + 1] = '\0';//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊԭ<CEAA><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>з<EFBFBD>
|
||||
pBuffer[strlen(pBuffer)] = '\n';
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
TRACE("%s\n", pBuffer);
|
||||
|
||||
FILE* pFile = NULL;
|
||||
fopen_s(&pFile, strLogPath.GetBuffer(), "ab+");
|
||||
if (NULL != pFile)
|
||||
{
|
||||
char acTime[32] = { 0 };
|
||||
SYSTEMTIME stTime;
|
||||
GetLocalTime(&stTime);
|
||||
sprintf_s(acTime, 32, "[%02d-%02d %02d:%02d:%02d.%03d] ", stTime.wMonth, stTime.wDay, stTime.wHour, stTime.wMinute, stTime.wSecond, stTime.wMilliseconds);
|
||||
|
||||
fwrite(acTime, 1, strlen(acTime), pFile);
|
||||
fwrite(pBuffer, 1, strlen(pBuffer), pFile);
|
||||
fwrite("\r\n", 1, strlen("\r\n"), pFile);
|
||||
fclose(pFile);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&stCritical);
|
||||
}
|
||||
92
Plugin/Fast/stdafx.h
Normal file
92
Plugin/Fast/stdafx.h
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
// stdafx.h : <20><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
// <20><><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>
|
||||
// <20>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // <20><> Windows ͷ<><CDB7><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString <20><><EFBFBD>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
|
||||
// <20>ر<EFBFBD> MFC <20><>ijЩ<C4B3><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7>ĺ<EFBFBD><C4BA>Եľ<D4B5><C4BE><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
||||
#include <afxext.h> // MFC <20><>չ
|
||||
#include <afxdisp.h> // MFC <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#define WM_CAMERA_SNAP 10999
|
||||
|
||||
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC <20><> Internet Explorer 4 <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD><D6A7>
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC <20><> Windows <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD><D6A7>
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcontrolbars.h> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳؼ<CDBF><D8BC><EFBFBD><EFBFBD><EFBFBD> MFC ֧<><D6A7>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include "json.h"
|
||||
#include "../Protocol.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
typedef struct ST_THREAD_PARAM
|
||||
{
|
||||
void * pParent;
|
||||
int nIdx;
|
||||
}
|
||||
ST_THREAD_PARAM;
|
||||
|
||||
|
||||
#define COLOR_R Scalar(0, 0, 255)
|
||||
#define COLOR_B Scalar(255, 0, 0)
|
||||
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined _M_IX86
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_X64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#else
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HIK_RGBD = 0,
|
||||
DAHUA_FISHEYE = 1,
|
||||
DAHUA_FISHEYE_LIVE = 2
|
||||
|
||||
}ENUM_CAMERA_TYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RT_STREAMING = 0,
|
||||
SNAP_PICTURE = 1,
|
||||
|
||||
}ENUM_PLAY_TYPE;
|
||||
|
||||
|
||||
float getAngelOfTwoVector(Point2f &pt1, Point2f &pt2, Point2f &c);
|
||||
void splitString(const string& s, vector<string>& v, const string& c);
|
||||
void LogOutToFile(const char* fmt, ...);
|
||||
|
||||
|
||||
#include "Mv3dRgbdApi.h"
|
||||
#include "Mv3dRgbdDefine.h"
|
||||
#include "Mv3dRgbdImgProc.h"
|
||||
8
Plugin/Fast/targetver.h
Normal file
8
Plugin/Fast/targetver.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> SDKDDKVer.h <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE> Windows ƽ̨<C6BD><CCA8>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ҪΪ<D2AA><CEAA>ǰ<EFBFBD><C7B0> Windows ƽ̨<C6BD><CCA8><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WinSDKVer.h<><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><> _WIN32_WINNT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪҪ֧<D2AA>ֵ<EFBFBD>ƽ̨<C6BD><CCA8>Ȼ<EFBFBD><C8BB><EFBFBD>ٰ<EFBFBD><D9B0><EFBFBD> SDKDDKVer.h<><68>
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user