Skip to content

Commit 53058fb

Browse files
committed
重构,使用Opencv和VFW两种方式实现相机管理
1 parent 9118950 commit 53058fb

18 files changed

+818
-336
lines changed

.vs/EntranceGuardClient/v15/.suo

39.5 KB
Binary file not shown.
37.6 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.

EntranceGuardClient.sln

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27130.2003
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EntranceGuardClient", "EntranceGuardClient\EntranceGuardClient.vcxproj", "{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Debug|x64.ActiveCfg = Debug|x64
17+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Debug|x64.Build.0 = Debug|x64
18+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Debug|x86.ActiveCfg = Debug|Win32
19+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Debug|x86.Build.0 = Debug|Win32
20+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Release|x64.ActiveCfg = Release|x64
21+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Release|x64.Build.0 = Release|x64
22+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Release|x86.ActiveCfg = Release|Win32
23+
{FD98DEBD-99CF-4215-9EAD-1F75E12D65C8}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {A71C2BE2-0BE2-4F67-BEBC-2D42C83547B1}
30+
EndGlobalSection
31+
EndGlobal

EntranceGuardClient/CameraContext.cpp

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/***********************************************************************
2+
* Module: CamaraContext.cpp
3+
* Author: lenovo
4+
* Modified: 2018Äê1ÔÂ30ÈÕ 16:02:01
5+
* Purpose: Implementation of the class CamaraContext
6+
***********************************************************************/
7+
8+
#include "stdafx.h"
9+
#include "CameraContext.h"
10+
11+
////////////////////////////////////////////////////////////////////////
12+
// Name: CamaraContext::CamaraContext()
13+
// Purpose: Implementation of CamaraContext::CamaraContext()
14+
// Return:
15+
////////////////////////////////////////////////////////////////////////
16+
17+
CameraContext::CameraContext()
18+
{
19+
cameraManager = NULL;
20+
}
21+
22+
////////////////////////////////////////////////////////////////////////
23+
// Name: CamaraContext::~CamaraContext()
24+
// Purpose: Implementation of CamaraContext::~CamaraContext()
25+
// Return:
26+
////////////////////////////////////////////////////////////////////////
27+
28+
CameraContext::~CameraContext()
29+
{
30+
// TODO : implement
31+
delete cameraManager;
32+
cameraManager = NULL;
33+
}
34+
35+
////////////////////////////////////////////////////////////////////////
36+
// Name: CamaraContext::Cls_OnVideoCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify)
37+
// Purpose: Implementation of CamaraContext::Cls_OnVideoCommand()
38+
// Parameters:
39+
// - hWnd
40+
// - id
41+
// - hwndCtl
42+
// - codeNotify
43+
// Return: void
44+
////////////////////////////////////////////////////////////////////////
45+
46+
void CameraContext::Cls_OnVideoCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify)
47+
{
48+
this->cameraManager->Cls_OnVideoCommand(hWnd, id, hwndCtl, codeNotify);
49+
}
50+
51+
////////////////////////////////////////////////////////////////////////
52+
// Name: CamaraContext::setCameraManager(CameraManager* cameraManager)
53+
// Purpose: Implementation of CamaraContext::setCameraManager()
54+
// Parameters:
55+
// - cameraManager
56+
// Return: void
57+
////////////////////////////////////////////////////////////////////////
58+
59+
void CameraContext::setCameraManager(CameraManager* cameraManager)
60+
{
61+
// TODO : implement
62+
this->cameraManager = cameraManager;
63+
}
64+
65+
////////////////////////////////////////////////////////////////////////
66+
// Name: CamaraContext::getCameraManager()
67+
// Purpose: Implementation of CamaraContext::getCameraManager()
68+
// Return: CamaraManager*
69+
////////////////////////////////////////////////////////////////////////
70+
71+
CameraManager* CameraContext::getCameraManager(void)
72+
{
73+
// TODO : implement
74+
return this->cameraManager;
75+
}

EntranceGuardClient/CameraContext.h

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/***********************************************************************
2+
* Module: CamaraContext.h
3+
* Author: lenovo
4+
* Modified: 2018Äê1ÔÂ30ÈÕ 16:02:01
5+
* Purpose: Declaration of the class CamaraContext
6+
***********************************************************************/
7+
8+
#ifndef _CAMARACONTEXT_
9+
#define _CAMARACONTEXT_
10+
11+
class CameraManager;
12+
13+
#include "CameraManager.h"
14+
15+
class CameraContext
16+
{
17+
public:
18+
CameraContext();
19+
~CameraContext();
20+
void Cls_OnVideoCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify);
21+
void setCameraManager(CameraManager* cameraManager);
22+
CameraManager* getCameraManager(void);
23+
24+
protected:
25+
private:
26+
CameraManager* cameraManager;
27+
28+
29+
};
30+
31+
#endif

EntranceGuardClient/CameraManager.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/***********************************************************************
2+
* Module: CamaraManager.cpp
3+
* Author: lenovo
4+
* Modified: 2018Äê1ÔÂ30ÈÕ 16:03:27
5+
* Purpose: Implementation of the class CamaraManager
6+
***********************************************************************/
7+
8+
#include "stdafx.h"
9+
#include "CameraManager.h"
10+
11+
////////////////////////////////////////////////////////////////////////
12+
// Name: CamaraManager::setWinLog(WinLogger winLog)
13+
// Purpose: Implementation of CamaraManager::setWinLog()
14+
// Parameters:
15+
// - winLog
16+
// Return: void
17+
////////////////////////////////////////////////////////////////////////
18+
19+
void CameraManager::setWinLog(WinLogger& winLog)
20+
{
21+
this->winLog = &winLog;
22+
}
23+
24+
////////////////////////////////////////////////////////////////////////
25+
// Name: CamaraManager::getWinLog()
26+
// Purpose: Implementation of CamaraManager::getWinLog()
27+
// Return: WinLogger
28+
////////////////////////////////////////////////////////////////////////
29+
30+
WinLogger* CameraManager::getWinLog(void)
31+
{
32+
// TODO : implement
33+
return this->winLog;
34+
}

EntranceGuardClient/CameraManager.h

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/***********************************************************************
2+
* Module: CamaraManager.h
3+
* Author: lenovo
4+
* Modified: 2018Äê1ÔÂ30ÈÕ 16:03:27
5+
* Purpose: Declaration of the class CamaraManager
6+
***********************************************************************/
7+
8+
#if !defined(__guard_CamaraManager_h)
9+
#define __guard_CamaraManager_h
10+
11+
// class WinLogger;
12+
13+
#include "WinLogger.h"
14+
#include "stdafx.h"
15+
16+
class CameraManager
17+
{
18+
public:
19+
virtual void Cls_OnVideoCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify)=0;
20+
void setWinLog(WinLogger &winLog);
21+
WinLogger* getWinLog(void);
22+
23+
protected:
24+
WinLogger* winLog;
25+
26+
private:
27+
28+
29+
};
30+
31+
#endif

EntranceGuardClient/CvManager.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/***********************************************************************
2+
* Module: CvManager.cpp
3+
* Author: lenovo
4+
* Modified: 2018Äê1ÔÂ30ÈÕ 16:03:00
5+
* Purpose: Implementation of the class CvManager
6+
***********************************************************************/
7+
8+
#include "stdafx.h"
9+
#include "CvManager.h"
10+
11+
////////////////////////////////////////////////////////////////////////
12+
// Name: CvManager::Cls_OnVideoCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify)
13+
// Purpose: Implementation of CvManager::Cls_OnVideoCommand()
14+
// Parameters:
15+
// - hWnd
16+
// - id
17+
// - hwndCtl
18+
// - codeNotify
19+
// Return: void
20+
////////////////////////////////////////////////////////////////////////
21+
22+
void CvManager::Cls_OnVideoCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify)
23+
{
24+
// TODO : implement
25+
MessageBox(NULL, TEXT("12"), TEXT("123"), 1);
26+
}

EntranceGuardClient/CvManager.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/***********************************************************************
2+
* Module: CvManager.h
3+
* Author: lenovo
4+
* Modified: 2018Äê1ÔÂ30ÈÕ 16:03:00
5+
* Purpose: Declaration of the class CvManager
6+
***********************************************************************/
7+
8+
#if !defined(__guard_CvManager_h)
9+
#define __guard_CvManager_h
10+
11+
#include "CameraManager.h"
12+
13+
class CvManager : public CameraManager
14+
{
15+
public:
16+
void Cls_OnVideoCommand(HWND hWnd, int id, HWND hwndCtl, UINT codeNotify);
17+
18+
protected:
19+
private:
20+
21+
};
22+
23+
#endif
634 Bytes
Binary file not shown.

EntranceGuardClient/EntranceGuardClient.vcxproj

+8
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,20 @@
143143
</Link>
144144
</ItemDefinitionGroup>
145145
<ItemGroup>
146+
<ClInclude Include="CameraContext.h" />
147+
<ClInclude Include="CameraManager.h" />
148+
<ClInclude Include="CvManager.h" />
146149
<ClInclude Include="EntranceGuardClient.h" />
147150
<ClInclude Include="resource.h" />
148151
<ClInclude Include="stdafx.h" />
149152
<ClInclude Include="targetver.h" />
153+
<ClInclude Include="VfwUtility.h" />
150154
<ClInclude Include="WinLogger.h" />
151155
</ItemGroup>
152156
<ItemGroup>
157+
<ClCompile Include="CameraContext.cpp" />
158+
<ClCompile Include="CameraManager.cpp" />
159+
<ClCompile Include="CvManager.cpp" />
153160
<ClCompile Include="EntranceGuardClient.cpp" />
154161
<ClCompile Include="stdafx.cpp">
155162
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
@@ -158,6 +165,7 @@
158165
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
159166
</ClCompile>
160167
<ClCompile Include="VfwUtility.cpp" />
168+
<ClCompile Include="WinLogger.cpp" />
161169
</ItemGroup>
162170
<ItemGroup>
163171
<ResourceCompile Include="EntranceGuardClient.rc" />

EntranceGuardClient/EntranceGuardClient.vcxproj.filters

+24
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@
3030
<ClInclude Include="WinLogger.h">
3131
<Filter>头文件</Filter>
3232
</ClInclude>
33+
<ClInclude Include="CvManager.h">
34+
<Filter>头文件</Filter>
35+
</ClInclude>
36+
<ClInclude Include="VfwUtility.h">
37+
<Filter>头文件</Filter>
38+
</ClInclude>
39+
<ClInclude Include="CameraManager.h">
40+
<Filter>头文件</Filter>
41+
</ClInclude>
42+
<ClInclude Include="CameraContext.h">
43+
<Filter>头文件</Filter>
44+
</ClInclude>
3345
</ItemGroup>
3446
<ItemGroup>
3547
<ClCompile Include="stdafx.cpp">
@@ -41,6 +53,18 @@
4153
<ClCompile Include="VfwUtility.cpp">
4254
<Filter>源文件</Filter>
4355
</ClCompile>
56+
<ClCompile Include="CvManager.cpp">
57+
<Filter>源文件</Filter>
58+
</ClCompile>
59+
<ClCompile Include="CameraManager.cpp">
60+
<Filter>源文件</Filter>
61+
</ClCompile>
62+
<ClCompile Include="CameraContext.cpp">
63+
<Filter>源文件</Filter>
64+
</ClCompile>
65+
<ClCompile Include="WinLogger.cpp">
66+
<Filter>源文件</Filter>
67+
</ClCompile>
4468
</ItemGroup>
4569
<ItemGroup>
4670
<ResourceCompile Include="EntranceGuardClient.rc">

0 commit comments

Comments
 (0)