├── Document ├── Consensus-based Tracking and Matching of Keypoints for Object Tracking.pdf └── Fastcluster. Fast Hierarchical, Agglomerative Clustering Routines for R and Python.pdf ├── LICENSE ├── Links.txt ├── Release v1.0 ├── cmtDlg.sln └── cmtDlg │ ├── Debug │ ├── cmtDlg.res │ ├── cmtDlg.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── cl.command.1.tlog │ │ ├── cmtDlg.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ ├── link.write.1.tlog │ │ ├── rc.command.1.tlog │ │ ├── rc.read.1.tlog │ │ └── rc.write.1.tlog │ └── vc120.idb │ ├── OpenCV300D.props │ ├── OpenCV300R.props │ ├── Release │ ├── cmtDlg.res │ └── cmtDlg.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── cl.command.1.tlog │ │ ├── cmtDlg.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ ├── link.write.1.tlog │ │ ├── rc.command.1.tlog │ │ ├── rc.read.1.tlog │ │ └── rc.write.1.tlog │ ├── cmt.cpp │ ├── cmt.h │ ├── cmtDlg.cpp │ ├── cmtDlg.h │ ├── cmtDlg.rc │ ├── cmtDlg.vcxproj │ ├── cmtDlg.vcxproj.filters │ ├── cmtDlgDlg.cpp │ ├── cmtDlgDlg.h │ ├── common.cpp │ ├── common.h │ ├── consensus.cpp │ ├── consensus.h │ ├── cvColorDef.h │ ├── cvGeneric.h │ ├── fastcluster.cpp │ ├── fastcluster.h │ ├── fusion.cpp │ ├── fusion.h │ ├── matcher.cpp │ ├── matcher.h │ ├── res │ ├── BRLNSB.TTF │ ├── BRLNSDB.TTF │ ├── BRLNSR.TTF │ ├── cmtDlg.ico │ ├── cmtDlg.rc2 │ ├── icoSet.pptx │ └── icoSet │ │ ├── 0.bmp │ │ ├── 0.png │ │ ├── F1_0.bmp │ │ ├── F1_1.bmp │ │ ├── F2_0.bmp │ │ ├── F2_1.bmp │ │ ├── F3_0.bmp │ │ ├── F3_1.bmp │ │ ├── F4_0.bmp │ │ ├── F4_1.bmp │ │ ├── F5_0.bmp │ │ ├── F5_1.bmp │ │ ├── F6_0.bmp │ │ ├── F6_1.bmp │ │ ├── F7_0.bmp │ │ ├── F7_1.bmp │ │ ├── F8_0.bmp │ │ ├── F8_1.bmp │ │ ├── Fn_LIST.bmp │ │ ├── Fn_x.bmp │ │ ├── making.png │ │ ├── making2.png │ │ └── pannel.bmp │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tracker.cpp │ └── tracker.h ├── Release v1.2 ├── cmtDlg.sln └── cmtDlg │ ├── Debug │ ├── cmtDlg.res │ ├── cmtDlg.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── cl.command.1.tlog │ │ ├── cmtDlg.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ ├── link.write.1.tlog │ │ ├── rc.command.1.tlog │ │ ├── rc.read.1.tlog │ │ └── rc.write.1.tlog │ └── vc120.idb │ ├── OpenCV300D.props │ ├── OpenCV300R.props │ ├── Release │ ├── cmtDlg.res │ └── cmtDlg.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── cl.command.1.tlog │ │ ├── cmtDlg.lastbuildstate │ │ ├── link.command.1.tlog │ │ ├── link.read.1.tlog │ │ ├── link.write.1.tlog │ │ ├── rc.command.1.tlog │ │ ├── rc.read.1.tlog │ │ └── rc.write.1.tlog │ ├── cmt.cpp │ ├── cmt.h │ ├── cmtDlg.cpp │ ├── cmtDlg.h │ ├── cmtDlg.rc │ ├── cmtDlg.vcxproj │ ├── cmtDlg.vcxproj.filters │ ├── cmtDlgDlg.cpp │ ├── cmtDlgDlg.h │ ├── common.cpp │ ├── common.h │ ├── consensus.cpp │ ├── consensus.h │ ├── cvColorDef.hpp │ ├── cvGeneric.hpp │ ├── fastcluster.cpp │ ├── fastcluster.h │ ├── fusion.cpp │ ├── fusion.h │ ├── gcPreprocess.hpp │ ├── gcProfile.hpp │ ├── matcher.cpp │ ├── matcher.h │ ├── res │ ├── BRLNSB.TTF │ ├── BRLNSDB.TTF │ ├── BRLNSR.TTF │ ├── cmtDlg.ico │ ├── cmtDlg.rc2 │ ├── icoSet.pptx │ └── icoSet │ │ ├── 0.bmp │ │ ├── 0.png │ │ ├── F1_0.bmp │ │ ├── F1_1.bmp │ │ ├── F2_0.bmp │ │ ├── F2_1.bmp │ │ ├── F3_0.bmp │ │ ├── F3_1.bmp │ │ ├── F4_0.bmp │ │ ├── F4_1.bmp │ │ ├── F5_0.bmp │ │ ├── F5_1.bmp │ │ ├── F6_0.bmp │ │ ├── F6_1.bmp │ │ ├── F7_0.bmp │ │ ├── F7_1.bmp │ │ ├── F8_0.bmp │ │ ├── F8_1.bmp │ │ ├── Fn_LIST.bmp │ │ ├── Fn_x.bmp │ │ ├── making.png │ │ ├── making2.png │ │ └── pannel.bmp │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── tracker.cpp │ └── tracker.h └── WinCMT Tutorial.pdf /Document/Consensus-based Tracking and Matching of Keypoints for Object Tracking.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Document/Consensus-based Tracking and Matching of Keypoints for Object Tracking.pdf -------------------------------------------------------------------------------- /Document/Fastcluster. Fast Hierarchical, Agglomerative Clustering Routines for R and Python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Document/Fastcluster. Fast Hierarchical, Agglomerative Clustering Routines for R and Python.pdf -------------------------------------------------------------------------------- /Links.txt: -------------------------------------------------------------------------------- 1 | Clustering of Static-Adaptive Correspondences for Deformable Object Tracking 2 | >> http://www.gnebehay.com/cmt/ 3 | 4 | gnebehay-CppMT GitHub 5 | >> https://github.com/gnebehay/CppMT -------------------------------------------------------------------------------- /Release v1.0/cmtDlg.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30723.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cmtDlg", "cmtDlg\cmtDlg.vcxproj", "{76003894-29EE-417B-BCCA-EDB6BD12D527}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Debug|Win32.Build.0 = Debug|Win32 16 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Release|Win32.ActiveCfg = Release|Win32 17 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.res -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/cl.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/cl.command.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/cmtDlg.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit 2 | Debug|Win32|D:\cmtDlg\| 3 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/rc.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/rc.command.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/rc.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/rc.read.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/cmtDlg.tlog/rc.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/cmtDlg.tlog/rc.write.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Debug/vc120.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Debug/vc120.idb -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/OpenCV300D.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | D:\OpenCV300\build\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); 7 | D:\OpenCV300\build\x86\vc12\lib;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86); 8 | 9 | 10 | 11 | opencv_world300d.lib; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/OpenCV300R.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | D:\OpenCV300\build\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); 7 | D:\OpenCV300\build\x86\vc12\lib;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86); 8 | 9 | 10 | 11 | opencv_world300.lib; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.res -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/cl.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/cl.command.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/cmtDlg.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit 2 | Release|Win32|D:\cmtDlg\| 3 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/rc.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/rc.command.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/rc.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/rc.read.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/Release/cmtDlg.tlog/rc.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/Release/cmtDlg.tlog/rc.write.1.tlog -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmt.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/cmt.cpp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | #include "matcher.h" 6 | #include "tracker.h" 7 | #include "fusion.h" 8 | #include "consensus.h" 9 | 10 | namespace cmt { 11 | 12 | class CMT { 13 | 14 | public: 15 | 16 | CMT(const UINT& myID, const Ptr& detector, 17 | const DOUBLE& distCOEFF, const DOUBLE& distThresh, 18 | const string& notePath 19 | ){ 20 | this->myID = myID; 21 | this->detector = detector; 22 | this->isInit = FALSE; 23 | this->isRetrying = FALSE; 24 | 25 | this->frmCnt = 0; // Currently not in use 26 | this->distCoeff = distCOEFF; 27 | this->distThresh = distThresh; 28 | this->posGrowth = 0; 29 | 30 | this->notePath = notePath; 31 | this->notePath += LocalTimeCode(); 32 | this->notePath += " Active Mass F"; 33 | this->notePath += to_string(1 + this->myID); 34 | this->notePath += ".txt"; 35 | 36 | this->noteFile.open(this->notePath); 37 | }; 38 | 39 | ~CMT() 40 | { 41 | this->noteFile.close(); 42 | }; 43 | 44 | 45 | //---------------------------------------------------------------------------- 46 | VOID supplyKeyPoints(const vector& keypoints); 47 | VOID configDist(const BOOL& distCoeff, const BOOL& g_distThresh); 48 | 49 | VOID initialize(const Mat& imGray, const Rect& rect); 50 | BOOL processFrame(const Mat& imGray); 51 | 52 | BOOL determineFailure(Point2f& center); 53 | BOOL determineFailure(Point2f verticle[]); 54 | VOID recoverArchive(VOID); 55 | VOID distJournal(VOID); 56 | 57 | 58 | //---------------------------------------------------------------------------- 59 | Matcher matcher; 60 | Tracker tracker; 61 | Fusion fusion; 62 | Consensus consensus; 63 | 64 | Mat imPrev; 65 | Point2f center; 66 | Size2f sizeInitial; 67 | vector pointsActive; 68 | vector classesActive; 69 | RotatedRect bbRotated; 70 | 71 | 72 | //---------------------------------------------------------------------------- 73 | UINT myID; 74 | BOOL isInit; 75 | BOOL isRetrying; 76 | 77 | INT xLimit, yLimit; 78 | BOOL isVisible; 79 | Mat imArchive; 80 | vector pointsArchive; 81 | vector classesArchive; 82 | 83 | UINT frmCnt; 84 | ofstream noteFile; 85 | string notePath; 86 | 87 | 88 | //---------------------------------------------------------------------------- 89 | DOUBLE posChange; 90 | INT posGrowth; 91 | 92 | Point2f posCurrent, posPrev; 93 | 94 | 95 | private: 96 | 97 | Ptr detector; 98 | Ptr descriptor; 99 | vector keypoints; 100 | 101 | DOUBLE distCoeff, distThresh; 102 | 103 | }; 104 | 105 | } // namespace CMT 106 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmtDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/cmtDlg.cpp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmtDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/cmtDlg.h -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmtDlg.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/cmtDlg.rc -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmtDlg.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {76003894-29EE-417B-BCCA-EDB6BD12D527} 15 | cmtDlg 16 | MFCProj 17 | 18 | 19 | 20 | Application 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | Application 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | true 48 | $(VC_SourcePath); 49 | 50 | 51 | false 52 | $(VC_SourcePath); 53 | 54 | 55 | 56 | Use 57 | Level3 58 | Disabled 59 | _SCL_SECURE_NO_WARNINGS;WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 60 | false 61 | 62 | 63 | Windows 64 | true 65 | 66 | 67 | false 68 | true 69 | _DEBUG;%(PreprocessorDefinitions) 70 | 71 | 72 | 0x0412 73 | _DEBUG;%(PreprocessorDefinitions) 74 | $(IntDir);%(AdditionalIncludeDirectories) 75 | 76 | 77 | 78 | 79 | Level3 80 | Use 81 | Disabled 82 | true 83 | true 84 | _SCL_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 85 | false 86 | 87 | 88 | Windows 89 | true 90 | true 91 | true 92 | 93 | 94 | false 95 | true 96 | NDEBUG;%(PreprocessorDefinitions) 97 | 98 | 99 | 0x0412 100 | NDEBUG;%(PreprocessorDefinitions) 101 | $(IntDir);%(AdditionalIncludeDirectories) 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | Create 134 | Create 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmtDlg.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {3b59f1b5-291f-4a4b-b729-d4544d21cae2} 18 | 19 | 20 | {8d4197c1-a426-47a0-87a0-5705369e8c77} 21 | 22 | 23 | {8e83d2ef-584e-464d-91a7-94dfe96995eb} 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 헤더 파일 32 | 33 | 34 | 헤더 파일 35 | 36 | 37 | 헤더 파일 38 | 39 | 40 | 헤더 파일 41 | 42 | 43 | 헤더 파일 44 | 45 | 46 | Robinus\header 47 | 48 | 49 | Robinus\header 50 | 51 | 52 | Robinus\header 53 | 54 | 55 | Robinus\header 56 | 57 | 58 | Robinus\header 59 | 60 | 61 | Robinus\header 62 | 63 | 64 | Robinus\header 65 | 66 | 67 | Robinus\header 68 | 69 | 70 | Robinus\header 71 | 72 | 73 | 74 | 75 | 소스 파일 76 | 77 | 78 | 소스 파일 79 | 80 | 81 | 소스 파일 82 | 83 | 84 | Robinus\source 85 | 86 | 87 | Robinus\source 88 | 89 | 90 | Robinus\source 91 | 92 | 93 | Robinus\source 94 | 95 | 96 | Robinus\source 97 | 98 | 99 | Robinus\source 100 | 101 | 102 | Robinus\source 103 | 104 | 105 | 106 | 107 | 리소스 파일 108 | 109 | 110 | 111 | 112 | 리소스 파일 113 | 114 | 115 | 116 | 117 | 리소스 파일 118 | 119 | 120 | 리소스 파일 121 | 122 | 123 | 리소스 파일 124 | 125 | 126 | 리소스 파일 127 | 128 | 129 | 리소스 파일 130 | 131 | 132 | 리소스 파일 133 | 134 | 135 | 리소스 파일 136 | 137 | 138 | 리소스 파일 139 | 140 | 141 | 리소스 파일 142 | 143 | 144 | 리소스 파일 145 | 146 | 147 | 리소스 파일 148 | 149 | 150 | 리소스 파일 151 | 152 | 153 | 리소스 파일 154 | 155 | 156 | 리소스 파일 157 | 158 | 159 | 리소스 파일 160 | 161 | 162 | 리소스 파일 163 | 164 | 165 | 리소스 파일 166 | 167 | 168 | 리소스 파일 169 | 170 | 171 | 리소스 파일 172 | 173 | 174 | 리소스 파일 175 | 176 | 177 | 리소스 파일 178 | 179 | 180 | 리소스 파일 181 | 182 | 183 | 리소스 파일 184 | 185 | 186 | 리소스 파일 187 | 188 | 189 | 리소스 파일 190 | 191 | 192 | 리소스 파일 193 | 194 | 195 | 리소스 파일 196 | 197 | 198 | 리소스 파일 199 | 200 | 201 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmtDlgDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/cmtDlgDlg.cpp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cmtDlgDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/cmtDlgDlg.h -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/common.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "common.h" 3 | 4 | 5 | namespace cmt { 6 | 7 | //TODO: Check for even/uneven number of elements 8 | //The order of the elements of A is changed 9 | float median(vector& A) 10 | { 11 | 12 | if (A.size() == 0) 13 | { 14 | return numeric_limits::quiet_NaN(); 15 | } 16 | 17 | nth_element(A.begin(), A.begin() + A.size() / 2, A.end()); 18 | 19 | return A[A.size() / 2]; 20 | } 21 | 22 | Point2f rotate(const Point2f& v, const float& angle) 23 | { 24 | Point2f r; 25 | r.x = cos(angle) * v.x - sin(angle) * v.y; 26 | r.y = sin(angle) * v.x + cos(angle) * v.y; 27 | 28 | return r; 29 | } 30 | 31 | } /* namespace cmt */ 32 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // #define DEBUG_PROGRAM 4 | #include "cvGeneric.h" 5 | 6 | using namespace cv; 7 | using namespace std; 8 | 9 | namespace cmt { 10 | 11 | float median(vector& A); 12 | Point2f rotate(const Point2f& v, const float& angle); 13 | 14 | template 15 | int sgn(T& x) 16 | { 17 | if (x >= 0) return 1; 18 | else return -1; 19 | } 20 | 21 | } // namespace cmt 22 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/consensus.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "consensus.h" 3 | #include "fastcluster.h" 4 | 5 | 6 | namespace cmt { 7 | 8 | VOID Consensus::configDeform(const BOOL& isScale, const BOOL& isRotation) 9 | { 10 | this->isScale = isScale; 11 | this->isRotation = isRotation; 12 | } 13 | 14 | 15 | //--------------------------------------------------------------------------------------------------- 16 | // Calculate correspondences from foreground Constellation 17 | // Correlation of 2 vectors : normsPairwise, anglesPairwise 18 | //--------------------------------------------------------------------------------------------------- 19 | void Consensus::initialize(const vector& vectorsFG) 20 | { 21 | this->vectorsFG = vectorsFG; 22 | UINT numPointsFG = vectorsFG.size(); 23 | 24 | this->normsPairwise = MatND(Size(numPointsFG, numPointsFG), CV_32FC1); 25 | this->anglesPairwise = MatND(Size(numPointsFG, numPointsFG), CV_32FC1); 26 | 27 | for (register UINT i = 0; i < numPointsFG; ++i) 28 | { 29 | for (register UINT j = 0; j < numPointsFG; ++j) 30 | { 31 | Point2f v = vectorsFG[i] - vectorsFG[j]; 32 | 33 | float dist = norm(v); 34 | float angleCurrent = atan2(v.y, v.x); 35 | 36 | this->normsPairwise.at(i, j) = dist; 37 | this->anglesPairwise.at(i, j) = angleCurrent; 38 | } 39 | } 40 | } 41 | 42 | 43 | //--------------------------------------------------------------------------------------------------- 44 | // Estimate the changes in Scale and Rotation of pointsFused from the initial Constellation 45 | //--------------------------------------------------------------------------------------------------- 46 | BOOL Consensus::estimateScaleRotation( 47 | const vector& points, 48 | const vector& classes, 49 | float& scale, 50 | float& rotation 51 | ){ 52 | 53 | vector changesScale, changesAngle; 54 | 55 | UINT sizePoints = points.size(); 56 | if (sizePoints == 0) 57 | { 58 | return FALSE; 59 | } 60 | 61 | for (register UINT i = 0; i < sizePoints; ++i) 62 | { 63 | for (register UINT j = 0; j < sizePoints; j++) 64 | { 65 | if (classes[i] != classes[j]) 66 | { 67 | Point2f v = points[i] - points[j]; 68 | 69 | if (isScale) 70 | { 71 | float distCurrent = norm(v); 72 | float distInitial = this->normsPairwise.at(classes[i], classes[j]); 73 | float changeScale = distCurrent / distInitial; 74 | changesScale.push_back(changeScale); 75 | } 76 | 77 | if (isRotation) 78 | { 79 | float angleCurrent = atan2(v.y, v.x); 80 | float angleInitial = this->anglesPairwise.at(classes[i], classes[j]); 81 | float changeAngle = angleCurrent - angleInitial; 82 | 83 | if (fabs(changeAngle) > CV_PI) // Fix long-way anglesPairwise 84 | changeAngle = sgn(changeAngle) * 2 * CV_PI + changeAngle; 85 | 86 | changesAngle.push_back(changeAngle); 87 | } 88 | } 89 | } 90 | } 91 | 92 | if (changesScale.size() < 2) scale = 1; 93 | else scale = median(changesScale); 94 | 95 | if (changesAngle.size() < 2) rotation = 0; 96 | else rotation = median(changesAngle); 97 | 98 | return TRUE; 99 | } 100 | 101 | 102 | BOOL Consensus::findConsensus( 103 | const vector& points, 104 | const vector& classes, 105 | const float& scale, 106 | const float& rotation, 107 | Point2f& center, 108 | vector& pointsInlier, 109 | vector& classesInlier 110 | ){ 111 | 112 | UINT sizePoints = points.size(); 113 | 114 | //--------------------------------------------------------------------------------------------------- 115 | // If no points are available, reteurn nan 116 | //--------------------------------------------------------------------------------------------------- 117 | if (sizePoints == 0) 118 | { 119 | center.x = numeric_limits::quiet_NaN(); 120 | center.y = numeric_limits::quiet_NaN(); 121 | 122 | return FALSE; 123 | } 124 | 125 | 126 | //--------------------------------------------------------------------------------------------------- 127 | // Compute votes 128 | //--------------------------------------------------------------------------------------------------- 129 | vector votes(points.size()); 130 | 131 | for (register UINT it = 0; it < sizePoints; ++it) 132 | { // votes : pointsFused - DeformsFG 133 | votes[it] = points[it] - scale * rotate(vectorsFG[classes[it]], rotation); 134 | } 135 | 136 | t_index N = sizePoints; 137 | 138 | //This is a lot of memory, so we put it on the heap 139 | float* D = new float[N*(N - 1) / 2]; 140 | 141 | cluster_result Z(N - 1); 142 | 143 | //--------------------------------------------------------------------------------------------------- 144 | // Compute pairwise distances between votes 145 | //--------------------------------------------------------------------------------------------------- 146 | register int index = 0; 147 | for (register UINT it = 0; it < sizePoints; ++it) 148 | { 149 | for (register UINT j = it + 1; j < sizePoints; j++) 150 | { 151 | //TODO: This index calculation is correct, but is it a good thing? 152 | //int index = it * (points.size() - 1) - (it*it + it) / 2 + j - 1; 153 | D[index] = norm(votes[it] - votes[j]); 154 | index++; 155 | } 156 | } 157 | MST_linkage_core(N, D, Z); 158 | 159 | union_find nodes(N); 160 | 161 | //--------------------------------------------------------------------------------------------------- 162 | // Sort linkage by distance ascending 163 | //--------------------------------------------------------------------------------------------------- 164 | std::stable_sort(Z[0], Z[N - 1]); 165 | 166 | //S are cluster sizes 167 | int* S = new int[2 * N - 1]; 168 | 169 | // TODO: Why does this loop go to 2*N-1? 170 | // Shouldn't it be simply N? Everything > N gets overwritten later 171 | for (register int it = 0; it < (2*N - 1); ++it) S[it] = 1; 172 | 173 | // After the loop ends, parent contains the index of the last cluster 174 | t_index parent = 0; 175 | for (node const * NN = Z[0]; NN != Z[N - 1]; ++NN) 176 | { 177 | // Get two data points whose clusters are merged in step it. 178 | // Find the cluster identifiers for these points. 179 | t_index node1 = nodes.Find(NN->node1); 180 | t_index node2 = nodes.Find(NN->node2); 181 | 182 | // Merge the nodes in the union-find data structure by making them 183 | // children of a new node 184 | // if the distance is appropriate 185 | if (NN->dist < thrCutoff) 186 | { 187 | parent = nodes.Union(node1, node2); 188 | S[parent] = S[node1] + S[node2]; 189 | } 190 | } 191 | 192 | //--------------------------------------------------------------------------------------------------- 193 | // Get cluster labels 194 | //--------------------------------------------------------------------------------------------------- 195 | int* T = new int[N]; 196 | for (t_index it = 0; it < N; ++it) 197 | T[it] = nodes.Find(it); 198 | 199 | // Find largest cluster 200 | int S_max = distance(S, max_element(S, S + 2 * N - 1)); 201 | 202 | // Find inliers, compute center of votes 203 | pointsInlier.reserve(S[S_max]); 204 | classesInlier.reserve(S[S_max]); 205 | center.x = center.y = 0; 206 | 207 | for (register UINT it = 0; it < sizePoints; ++it) 208 | { 209 | // If point is in consensus cluster 210 | if (T[it] == S_max) 211 | { 212 | pointsInlier.push_back(points[it]); 213 | classesInlier.push_back(classes[it]); 214 | center.x += votes[it].x; 215 | center.y += votes[it].y; 216 | } 217 | } 218 | 219 | center.x /= pointsInlier.size(); 220 | center.y /= pointsInlier.size(); 221 | 222 | delete[] D; 223 | delete[] S; 224 | delete[] T; 225 | 226 | return TRUE; 227 | } 228 | 229 | } // namespace cmt 230 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/consensus.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Consensus { 9 | 10 | public: 11 | 12 | Consensus() : isScale(FALSE), isRotation(TRUE), thrCutoff(20) {}; 13 | 14 | VOID configDeform(const BOOL& isScale, const BOOL& isRotation); 15 | 16 | VOID initialize( 17 | const vector& vectorsFG 18 | ); 19 | 20 | BOOL estimateScaleRotation( 21 | const vector& points, 22 | const vector& classes, 23 | float& scale, 24 | float& rotation 25 | ); 26 | 27 | BOOL findConsensus( 28 | const vector& points, 29 | const vector& classes, 30 | const float& scale, 31 | const float& rotation, 32 | Point2f& center, 33 | vector& pointsInlier, 34 | vector& classesInlier 35 | ); 36 | 37 | 38 | private: 39 | 40 | BOOL isScale, isRotation; 41 | float thrCutoff; 42 | vector vectorsFG; 43 | MatND normsPairwise; 44 | MatND anglesPairwise; 45 | 46 | }; 47 | 48 | } // namespace cmt 49 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cvColorDef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | //====================================================== 5 | #define winRGB_Black RGB(255, 255, 255) 6 | #define winRGB_White RGB(0, 0, 0) 7 | #define winRGB_DKGray RGB(48, 48, 48) 8 | #define winRGB_Aquamarine RGB(127, 255, 212) 9 | #define winRGB_LightCoral RGB(240, 128, 128) 10 | #define winRGB_Light RGB(238, 221, 130) 11 | //------------------------------------------------------ 12 | #define winRGB_Tomato RGB(220, 20, 60) 13 | #define winRGB_PaleGreen RGB(152, 251, 152) 14 | #define winRGB_DeepSkyBlue RGB(0, 191, 255) 15 | #define winRGB_Violet RGB(238, 130, 238) 16 | #define winRGB_Orange RGB(255, 165, 0) 17 | #define winRGB_LemonChiffon RGB(255, 250, 205) 18 | #define winRGB_Cyan RGB(0, 255, 255) 19 | #define winRGB_Pink RGB(255, 192, 203) 20 | 21 | //====================================================== 22 | #define cvBGR_Black Scalar(0, 0, 0) 23 | #define cvBGR_White Scalar(255, 255, 255) 24 | #define cvBGR_Green Scalar(0, 255, 0) 25 | #define cvBGR_Sky Scalar(255, 255, 0) 26 | #define cvBGR_Yellow Scalar(0, 255, 255) 27 | #define cvBGR_Red Scalar(0, 0, 255) 28 | //------------------------------------------------------ 29 | #define cvBGR_Tomato Scalar(60, 20, 220) 30 | #define cvBGR_PaleGreen Scalar(152, 251, 152) 31 | #define cvBGR_DeepSkyBlue Scalar(255, 191, 0) 32 | #define cvBGR_Violet Scalar(238, 130, 238) 33 | #define cvBGR_Orange Scalar(0, 165, 255) 34 | #define cvBGR_LemonChiffon Scalar(205, 250, 255) 35 | #define cvBGR_Cyan Scalar(255, 255, 0) 36 | #define cvBGR_Pink Scalar(203, 192, 255) -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/cvGeneric.h: -------------------------------------------------------------------------------- 1 | // Robinus Fuser. 2015-09-15 22:45 2 | // Electronics Dept. Konkuk Univ. South Korea 3 | 4 | #pragma once 5 | 6 | #include // for QueryWinUserName() 7 | #pragma comment(lib, "Wtsapi32.lib") // for QueryWinUserName() 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "cvColorDef.h" 15 | 16 | using namespace cv; 17 | using namespace std; 18 | 19 | 20 | //---------------------------------------------------------------------------- 21 | #define keyDelay 1 22 | #define drawTimer 100 23 | #define maxThreads 8 24 | #define maxDetectors 2 25 | 26 | #define consoleSweep "\r\n \r\n \r\n \r\n " 27 | #define notify_ONE "Allow only one Tracker Process." 28 | #define notify_FIX "Turn of the Session first." 29 | #define notify_EOF "End of Track." 30 | 31 | //---------------------------------------------------------------------------- 32 | #ifndef TRUE 33 | #define TRUE 1 34 | #define FALSE 0 35 | #endif 36 | 37 | #ifndef VOID 38 | #define VOID void 39 | #endif 40 | 41 | typedef unsigned long long ULONGLONG; 42 | typedef int INT; 43 | typedef unsigned int UINT; 44 | typedef unsigned char UCHAR; 45 | //typedef bool BOOL; 46 | 47 | 48 | //============================================================================ 49 | // Global Variables & Definitions 50 | //---------------------------------------------------------------------------- 51 | // refer to "stdafx.cpp" 52 | //============================================================================ 53 | extern VideoCapture g_cap; 54 | extern VideoWriter g_writer; 55 | extern BOOL g_runningONE; 56 | extern vector g_keypoint; 57 | extern BOOL g_testDetector; 58 | extern UINT g_selDetector; 59 | extern Ptr g_detector; 60 | #define detector_GFTT 0 61 | #define detector_FAST 1 62 | //---------------------------------------------------------------------------- 63 | extern string g_wnd; 64 | extern Mat g_frm, g_frmToShow, 65 | g_frmGray, g_frmGrays[maxThreads]; 66 | extern vector> g_keypoints; 67 | extern Rect2f g_Rect; 68 | 69 | extern BOOL g_isScale; 70 | extern BOOL g_isRotation; 71 | extern FLOAT g_distCoeff, g_distThresh; 72 | extern string g_notePath; 73 | extern INT g_captureStat; 74 | #define capture_IDLE -1 75 | #define capture_RUNNING 1 76 | 77 | extern vector> g_pointsActive; 78 | extern Point2f g_verticles[maxThreads][4]; 79 | 80 | extern UINT g_IdxThread; 81 | extern BOOL g_isRedraw; 82 | 83 | extern CWinThread* pThreads[maxThreads]; 84 | extern CEvent warpEvents[maxThreads]; 85 | extern CEvent controlEvents[maxThreads]; 86 | extern CEvent allowProcess[maxThreads]; 87 | extern CEvent readyToDraw[maxThreads]; 88 | extern UINT posChange[maxThreads]; 89 | extern UINT retryCnt[maxThreads]; 90 | #define maximum_RETRY 10 91 | 92 | extern INT threadStat[maxThreads]; 93 | extern INT threadStatOld[maxThreads]; 94 | #define thread_VOID -1 95 | #define thread_IDLE 0 96 | #define thread_ACTIVE 1 97 | 98 | 99 | //============================================================================ 100 | // Global Functions 101 | //============================================================================ 102 | Ptr inline Config_GFTT(VOID) 103 | { 104 | UINT maxCorners = 700; 105 | DOUBLE qualityLevel = 0.001; 106 | DOUBLE minDistance = 15.0; 107 | UINT blockSize = 3; 108 | BOOL useHarrisDetector = FALSE; 109 | DOUBLE k = 0.04; 110 | 111 | return cv::GFTTDetector::create( 112 | maxCorners, // int maxCorners 113 | qualityLevel, // double qualityLevel 114 | minDistance, // double minDistance 115 | blockSize, // int blockSize 116 | useHarrisDetector, // bool useHarrisDetector 117 | k // double k 118 | ); 119 | } 120 | 121 | 122 | Ptr inline Config_FAST(VOID) 123 | { 124 | UINT threshold = 20; 125 | BOOL nonmaxSuppression = TRUE; 126 | UINT type = FastFeatureDetector::TYPE_9_16; 127 | 128 | return FastFeatureDetector::create( 129 | threshold, // int threshold 130 | nonmaxSuppression, // bool nonmaxSuppression 131 | type // int type 132 | ); 133 | } 134 | 135 | 136 | VOID inline GlobalInits(VOID) 137 | { 138 | g_captureStat = capture_IDLE; 139 | g_testDetector = FALSE; 140 | 141 | 142 | vector vecPoint_VOID; 143 | Point2f aPoint2f; 144 | vecPoint_VOID.push_back(aPoint2f); 145 | 146 | vector vecKeyPoint_VOID; 147 | KeyPoint aKeyPoint; 148 | vecKeyPoint_VOID.push_back(aKeyPoint); 149 | 150 | 151 | for (register UINT id = 0; id < maxThreads; ++id) 152 | { 153 | g_keypoints.push_back(vecKeyPoint_VOID); 154 | g_pointsActive.push_back(vecPoint_VOID); // Access from threadCMT() 155 | pThreads[id] = NULL; 156 | warpEvents[id].ResetEvent(); 157 | controlEvents[id].ResetEvent(); 158 | allowProcess[id].ResetEvent(); 159 | readyToDraw[id].ResetEvent(); 160 | threadStat[id] = thread_VOID; 161 | retryCnt[id] = 0; 162 | } 163 | } 164 | 165 | 166 | VOID inline SecureEndThread(INT threadStat[]) 167 | { 168 | for (register UINT id = 0; id < maxThreads; ++id) 169 | { 170 | BOOL RETRY = TRUE; 171 | while (RETRY) 172 | { 173 | warpEvents[id].SetEvent(); 174 | if (threadStat[id] == thread_VOID) RETRY = FALSE; 175 | } 176 | } 177 | } 178 | 179 | 180 | VOID inline GlobalExits(VOID) 181 | { 182 | g_writer.release(); 183 | g_cap.release(); 184 | g_captureStat = capture_IDLE; 185 | SecureEndThread(threadStat); 186 | cv::destroyAllWindows(); 187 | g_runningONE = FALSE; 188 | } 189 | 190 | 191 | CString inline QueryWinUserName(VOID) 192 | { 193 | DWORD dwCnt = 0; 194 | LPTSTR pStr = NULL; 195 | 196 | WTSQuerySessionInformation( 197 | WTS_CURRENT_SERVER_HANDLE, 198 | WTS_CURRENT_SESSION, 199 | WTSUserName, 200 | &pStr, 201 | &dwCnt); 202 | 203 | CString winUserName = pStr; 204 | WTSFreeMemory(pStr); 205 | 206 | return winUserName; 207 | } 208 | 209 | 210 | string inline LocalTime(BOOL bShowMS) 211 | { 212 | SYSTEMTIME systime; 213 | GetLocalTime(&systime); 214 | 215 | stringstream ss; 216 | string time; 217 | 218 | ss << systime.wYear << "." 219 | << systime.wMonth << "." 220 | << systime.wDay; 221 | 222 | #ifdef showDay 223 | string day; 224 | switch (systime.wDayOfWeek){ 225 | case 0: day = "Sun"; break; 226 | case 1: day = "Mon"; break; 227 | case 2: day = "Tue"; break; 228 | case 3: day = "Wed"; break; 229 | case 4: day = "Thur"; break; 230 | case 5: day = "Fri"; break; 231 | case 6: day = "Sat"; break; 232 | } 233 | ss << "." << day; 234 | #endif 235 | 236 | ss << " " << systime.wHour << ":" 237 | << systime.wMinute << ":" 238 | << systime.wSecond; 239 | 240 | if (bShowMS) ss << "(" << systime.wMilliseconds << ")"; 241 | 242 | time = ss.str(); 243 | return time; 244 | } 245 | 246 | 247 | string inline LocalTimeCode(VOID) 248 | { 249 | SYSTEMTIME systime; 250 | GetLocalTime(&systime); 251 | 252 | stringstream ss; 253 | string time; 254 | 255 | ss << systime.wYear 256 | << systime.wMonth 257 | << systime.wDay; 258 | 259 | #ifdef showDay 260 | string day; 261 | switch (systime.wDayOfWeek){ 262 | case 0: day = "Sun"; break; 263 | case 1: day = "Mon"; break; 264 | case 2: day = "Tue"; break; 265 | case 3: day = "Wed"; break; 266 | case 4: day = "Thur"; break; 267 | case 5: day = "Fri"; break; 268 | case 6: day = "Sat"; break; 269 | } 270 | ss << "." << day; 271 | #endif 272 | 273 | ss << systime.wHour 274 | << systime.wMinute 275 | << systime.wSecond 276 | << systime.wMilliseconds; 277 | 278 | time = ss.str(); 279 | return time; 280 | } 281 | 282 | 283 | //============================================================================ 284 | // [MFC] threadINFO 285 | //============================================================================ 286 | class threadINFO 287 | { 288 | public : 289 | // BOOL gate; 290 | int job; // Raw(-1) : Create(0) : Destruct(1) : Control(2) 291 | int idx; 292 | string name; 293 | 294 | #define tRAW -1 295 | #define tCREATE 0 296 | #define tDESTRUCT 1 297 | #define tCONTROL 2 298 | 299 | threadINFO() 300 | { 301 | // this->gate = FALSE; 302 | this->job = tRAW; 303 | this->idx = tRAW; 304 | this->name = ""; 305 | } 306 | 307 | VOID Clear(VOID){ 308 | // this->gate = FALSE; 309 | this->job = tRAW; 310 | this->idx = tRAW; 311 | this->name = ""; 312 | } 313 | 314 | template 315 | VOID Create(_T idx, string& name){ 316 | // this->gate = TRUE; 317 | this->job = tCREATE; 318 | this->idx = idx; 319 | this->name = name; 320 | } 321 | 322 | template 323 | VOID Destruct(_T idx, string& name){ 324 | // this->gate = TRUE; 325 | this->job = tDESTRUCT; 326 | this->idx = idx; 327 | this->name = name; 328 | } 329 | 330 | template 331 | VOID Control(_T idx, string& name){ 332 | // this->gate = TRUE; 333 | this->job = tCONTROL; 334 | this->idx = idx; 335 | this->name = name; 336 | } 337 | }; 338 | 339 | 340 | //============================================================================ 341 | // [MFC] keyINFO 342 | //============================================================================ 343 | class keyINFO 344 | { 345 | public : 346 | string keyMsg; 347 | int keyClass; 348 | }; 349 | 350 | 351 | //============================================================================ 352 | // [OpenCV - MFC] cvGENERIC 353 | //============================================================================ 354 | class cvGENERIC 355 | { 356 | public : 357 | 358 | //======================================================================== 359 | // Variables 360 | //======================================================================== 361 | LARGE_INTEGER lnFreqStart, lnFreqStop, lnStart, lnStop; 362 | ULONGLONG procTime; 363 | //------------------------------------------------------------------------ 364 | vector wnd; 365 | vector img; 366 | UINT rows, cols; 367 | VideoCapture cap; 368 | UINT frmCnt; 369 | //------------------------------------------------------------------------ 370 | string Vpath; // [ D:\\root\\title.avi ] 371 | string Vroot; // [ D:\\root\\ ] 372 | string VsubRoot; // [ D:\\root\\title\\ ] Created Sub-root 373 | string Vtitle; // [ title ] without extension 374 | //------------------------------------------------------------------------ 375 | Mat surTitleBox; 376 | BOOL bCreateDir; 377 | //------------------------------------------------------------------------ 378 | INT status; 379 | #define eEXIT 0 380 | #define eRUN 1 381 | //------------------------------------------------------------------------ 382 | #define kNA -1 383 | #define kNUM 0 384 | #define kFUNC 1 385 | //------------------------------------------------------------------------ 386 | INT threadsNUM; 387 | string threads[maxThreads]; 388 | 389 | 390 | //======================================================================== 391 | // Functions 392 | //======================================================================== 393 | cvGENERIC(); ~cvGENERIC(); 394 | 395 | VOID ResetQueryPerformance(VOID); 396 | ULONGLONG QueryPerformance(VOID); 397 | 398 | static Scalar PickBrush(UINT& mThreadID); 399 | static VOID OnMouse(int event, int x, int y, int flags, VOID *param); 400 | Rect2f GetRect(string& winName, Mat& frm, UINT& threadID); 401 | 402 | string CreateWND(VOID); 403 | VOID CreateWND(UINT wnd_num); 404 | VOID PutSurTitle(Mat &panel, string surTitle); 405 | 406 | BOOL LoadImg(Mat &outImg); 407 | UINT LoadImgs(VOID); 408 | string LoadVid(BOOL CreatDir); 409 | 410 | BOOL SaveFrms(Mat& frm, UINT& frmCnt); 411 | BOOL SaveJPG(Mat& img); 412 | BOOL SavePNG(Mat& img); 413 | 414 | keyINFO ReadKey(UINT delay); 415 | 416 | vector QueryActiveThread(INT* threadStat); 417 | VOID ReserveThreadStat(INT threadStat[], INT threadStatOld[]); 418 | BOOL QueryThreadChange(INT threadStat[], INT threadStatOld[]); 419 | 420 | threadINFO WarpThreadPool(string& threadName); 421 | threadINFO ControlThread(string& threadNum); 422 | }; 423 | 424 | 425 | //============================================================================ 426 | // Constructor & Destructor 427 | //============================================================================ 428 | inline cvGENERIC::cvGENERIC() 429 | { 430 | this->frmCnt = 0; 431 | this->status = eRUN; 432 | 433 | threadsNUM = 0; 434 | 435 | for (register UINT it = 0; it < maxThreads; ++it) 436 | this->threads[it] = ""; 437 | } 438 | 439 | inline cvGENERIC::~cvGENERIC(){} 440 | 441 | 442 | //============================================================================ 443 | // [Windows] QueryPerformance 444 | //---------------------------------------------------------------------------- 445 | // Process-time Measurement in [ms] 446 | // Should call ResetQueryPerformance() at every start of the Query-sequence 447 | //============================================================================ 448 | VOID inline cvGENERIC::ResetQueryPerformance() 449 | { 450 | ::QueryPerformanceFrequency(&this->lnFreqStart); 451 | ::QueryPerformanceCounter(&this->lnStart); 452 | } 453 | 454 | ULONGLONG inline cvGENERIC::QueryPerformance() 455 | { 456 | ::QueryPerformanceCounter(&this->lnStop); 457 | ::QueryPerformanceFrequency(&this->lnFreqStop); 458 | 459 | this->procTime = static_cast( 460 | ( (this->lnStop.QuadPart - this->lnStart.QuadPart) * 1000000 ) / 461 | ( (this->lnFreqStart.QuadPart + this->lnFreqStop.QuadPart ) / 2 ) 462 | ); 463 | 464 | return procTime; 465 | } 466 | 467 | 468 | Scalar inline cvGENERIC::PickBrush(UINT& mThreadID) 469 | { 470 | Scalar BRUSH; 471 | 472 | if (mThreadID == 0) BRUSH = cvBGR_Tomato; 473 | else if (mThreadID == 1) BRUSH = cvBGR_PaleGreen; 474 | else if (mThreadID == 2) BRUSH = cvBGR_DeepSkyBlue; 475 | else if (mThreadID == 3) BRUSH = cvBGR_Violet; 476 | else if (mThreadID == 4) BRUSH = cvBGR_Orange; 477 | else if (mThreadID == 5) BRUSH = cvBGR_LemonChiffon; 478 | else if (mThreadID == 6) BRUSH = cvBGR_Cyan; 479 | else if (mThreadID == 7) BRUSH = cvBGR_Pink; 480 | 481 | return BRUSH; 482 | } 483 | 484 | 485 | //---------------------------------------------------------------------------- 486 | // Variables for cvGENERIC::OnMouse 487 | //---------------------------------------------------------------------------- 488 | static string frameToShow; 489 | static Mat frmPreserve, frmToShow; 490 | static Point2f mPoint; 491 | static Rect2f mRect; 492 | static BOOL mDrag; 493 | static UINT mThreadID; 494 | static BOOL bInitROI; 495 | 496 | 497 | //============================================================================ 498 | // [OpenCV] onMouse 499 | //---------------------------------------------------------------------------- 500 | // MouseCallback function 501 | // Designed for getRect with "Mouse-dragging" 502 | //============================================================================ 503 | VOID inline cvGENERIC::OnMouse(int event, int x, int y, int flags, VOID *param) 504 | { 505 | Scalar BRUSH = PickBrush(mThreadID); 506 | 507 | if (event == CV_EVENT_LBUTTONDOWN && !mDrag) 508 | { 509 | mPoint = Point2f(x, y); 510 | mDrag = TRUE; 511 | } 512 | 513 | if (event == CV_EVENT_MOUSEMOVE && mDrag) 514 | { 515 | frmPreserve.copyTo(frmToShow); 516 | rectangle(frmToShow, mPoint, Point2f(x, y), BRUSH, 2); 517 | imshow(frameToShow, frmToShow); 518 | } 519 | 520 | if (event == CV_EVENT_LBUTTONUP && mDrag) 521 | { 522 | mRect = Rect2f(mPoint, Point2f(x, y)); 523 | 524 | //---------------------------------------------------- 525 | // Coordinate calibration on Inverse-oriented dragging 526 | //---------------------------------------------------- 527 | if (mRect.width < 0){ 528 | mRect.x += mRect.width; 529 | mRect.width = abs(mRect.width); 530 | } 531 | if (mRect.height < 0){ 532 | mRect.y += mRect.height; 533 | mRect.height = abs(mRect.height); 534 | } 535 | 536 | mDrag = FALSE; 537 | bInitROI = TRUE; 538 | } 539 | } 540 | 541 | 542 | //============================================================================ 543 | // [onMouse] getRect 544 | //============================================================================ 545 | Rect2f inline cvGENERIC::GetRect(string& winName, Mat& frm, UINT& threadID) 546 | { 547 | mThreadID = threadID; 548 | 549 | bInitROI = FALSE; 550 | mDrag = FALSE; 551 | frameToShow = winName; 552 | mRect = Rect2f(-1, -1, -1, -1); 553 | 554 | frm.copyTo(frmPreserve); 555 | 556 | setMouseCallback(winName, OnMouse, NULL); 557 | while (!bInitROI) waitKey(keyDelay); 558 | setMouseCallback(winName, NULL, NULL); 559 | 560 | return mRect; 561 | } 562 | 563 | 564 | //======================================================================== 565 | // Multiple cv::NamedWindow Creator /w prefix "wnd_" 566 | //======================================================================== 567 | string inline cvGENERIC::CreateWND() 568 | { 569 | this->wnd.clear(); 570 | this->wnd.push_back("wnd_00"); namedWindow(wnd[0]); 571 | return this->wnd[0]; 572 | } 573 | 574 | VOID inline cvGENERIC::CreateWND(UINT wnd_num) 575 | { 576 | this->wnd.clear(); 577 | 578 | for (UINT it = 0; it < wnd_num; ++it){ 579 | stringstream ss; 580 | ss << "wnd_" << std::setfill('0') << std::setw(2) << it; 581 | this->wnd.push_back(ss.str()); namedWindow(wnd[it]); 582 | } 583 | } 584 | 585 | 586 | //======================================================================== 587 | // [OpenCV] Put SurTitle 588 | //======================================================================== 589 | VOID inline cvGENERIC::PutSurTitle(Mat &panel, string surTitle) 590 | { 591 | this->surTitleBox = panel(cv::Rect(0, 0, panel.cols, 30)); 592 | this->surTitleBox.setTo(cvBGR_Black); 593 | 594 | putText(surTitleBox, surTitle, 595 | Point(5, 20), FONT_HERSHEY_SIMPLEX, 0.6, 596 | cvBGR_Yellow 597 | ); 598 | } 599 | 600 | 601 | //======================================================================== 602 | // [MFC] Single Image File Loader 603 | //======================================================================== 604 | BOOL inline cvGENERIC::LoadImg(Mat &outImg) 605 | { 606 | //----------------------------------------------------------- 607 | // [Set CFileDialog Options] 608 | //----------------------------------------------------------- 609 | static TCHAR BASED_CODE szFilter[] = 610 | _T("image | *.bmp; *.jpg; *.png; |") 611 | _T("jpg | *.jpg; |") 612 | _T("png | *.png; ||"); 613 | 614 | CFileDialog FileDlg(TRUE, 0, 0, 615 | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, 616 | szFilter 617 | ); 618 | 619 | if (FileDlg.DoModal() == IDOK) 620 | { 621 | CT2CA Apath(FileDlg.GetPathName()); 622 | outImg = imread(Apath.operator LPSTR()); 623 | 624 | CT2CA Aroot(FileDlg.GetFolderPath()); 625 | this->Vroot = Aroot.operator LPSTR(); 626 | 627 | stringstream ss; 628 | ss << Vroot << "\\"; 629 | this->Vroot = ss.str(); 630 | 631 | CT2CA Atitle(FileDlg.GetFileTitle()); 632 | this->Vtitle = Atitle.operator LPSTR(); 633 | } 634 | 635 | return !(outImg.empty()); 636 | } 637 | 638 | 639 | //======================================================================== 640 | // [MFC] Multiple Image Files Loader 641 | //======================================================================== 642 | UINT inline cvGENERIC::LoadImgs() 643 | { 644 | vector imgPath; 645 | this->img.clear(); 646 | 647 | #define MAX_FILES 10000 648 | #define BUFFER_SIZE ((MAX_FILES * (MAX_PATH + 1)) + 1) 649 | 650 | //----------------------------------------------------------- 651 | // [Memory Allocation] wchar_t* = CString 652 | //----------------------------------------------------------- 653 | CString CSTRING; 654 | wchar_t* Linear = CSTRING.GetBuffer(BUFFER_SIZE); 655 | CSTRING.ReleaseBuffer(); 656 | 657 | //----------------------------------------------------------- 658 | // [Set CFileDialog Options] 659 | //----------------------------------------------------------- 660 | static TCHAR BASED_CODE szFilter[] = 661 | _T("image | *.bmp; *.jpg; *.png; |") 662 | _T("jpg | *.jpg; |") 663 | _T("png | *.png; ||"); 664 | 665 | CFileDialog FileDlg(TRUE, 0, 0, 666 | OFN_ALLOWMULTISELECT, 667 | szFilter 668 | ); 669 | 670 | OPENFILENAME& OFN = FileDlg.GetOFN(); 671 | OFN.nMaxFile = BUFFER_SIZE; 672 | OFN.lpstrFile = Linear; 673 | 674 | //----------------------------------------------------------- 675 | // [File Segmentation] 676 | //----------------------------------------------------------- 677 | if (FileDlg.DoModal() == IDOK) 678 | { 679 | CString ROOT; CString fileName; 680 | 681 | wchar_t* EOL = Linear + BUFFER_SIZE - 2; 682 | wchar_t* ENTRY = Linear; 683 | 684 | while ((Linear < EOL) && (*Linear)) Linear++; 685 | 686 | if (Linear > ENTRY) 687 | { // [ROOT Stage] 688 | ROOT = ENTRY; 689 | Linear++; 690 | 691 | // Case of Loading a Single File ------------ 692 | if (!(*Linear)){ 693 | CT2CA CONV(ROOT); 694 | imgPath.push_back(CONV.operator LPSTR()); 695 | } 696 | // ------------------------------------------ 697 | 698 | while ((Linear < EOL) && (*Linear)) 699 | { 700 | ENTRY = Linear; 701 | while ((Linear < EOL) && (*Linear)) Linear++; 702 | 703 | if (Linear > ENTRY) 704 | { // [fileName Stage] 705 | fileName = ROOT; fileName += "\\"; fileName += ENTRY; 706 | CT2CA CONV(fileName); 707 | imgPath.push_back(CONV.operator LPSTR()); 708 | Linear++; 709 | } 710 | } 711 | } 712 | #undef MAX_FILES 713 | #undef BUFFER_SIZE 714 | } // From here use vector imgPath 715 | 716 | for (UINT it = 0; it < imgPath.size(); ++it) 717 | this->img.push_back(imread(imgPath[it])); 718 | 719 | return this->img.size(); 720 | } 721 | 722 | 723 | //======================================================================== 724 | // [MFC] Single Video File Loader 725 | //======================================================================== 726 | string inline cvGENERIC::LoadVid(BOOL CreatDir) 727 | { 728 | LPCTSTR szFilter = L"video | *.mp4; *.avi; ||"; 729 | CFileDialog FileDlg(1, 0, 0, 0, szFilter); 730 | 731 | if (FileDlg.DoModal() == IDOK) 732 | { 733 | CT2CA Atitle(FileDlg.GetFileTitle()); 734 | this->Vtitle = Atitle.operator LPSTR(); 735 | 736 | CT2CA Apath(FileDlg.GetPathName()); 737 | this->Vpath = Apath.operator LPSTR(); 738 | 739 | CT2CA Aroot(FileDlg.GetFolderPath()); 740 | this->Vroot = Aroot.operator LPSTR(); 741 | 742 | stringstream ss; 743 | ss << Vroot << "\\"; 744 | this->Vroot = ss.str(); 745 | 746 | ss << Vtitle << "\\"; 747 | this->VsubRoot = ss.str(); 748 | 749 | if (CreatDir == TRUE){ 750 | this->bCreateDir = TRUE; 751 | CA2CT Troot(VsubRoot.c_str()); 752 | ::CreateDirectory(Troot, 0); 753 | } 754 | else { 755 | this->bCreateDir = FALSE; 756 | } 757 | } 758 | 759 | VideoCapture vid(Vpath); 760 | if (vid.isOpened()) 761 | { 762 | Mat frm; 763 | vid >> frm; 764 | this->rows = vid.get(CAP_PROP_FRAME_HEIGHT); 765 | this->cols = vid.get(CAP_PROP_FRAME_WIDTH); 766 | } 767 | 768 | vid.release(); 769 | 770 | return Vpath; 771 | } 772 | 773 | 774 | //======================================================================== 775 | // [OpenCV] Save a Video frame with [ frmCnt ] as postfix 776 | //------------------------------------------------------------------------ 777 | // Save into the Video's subFolder >> D:\\root\\title\\title_000000.jpg 778 | // If the subFolder was not created, returns FALSE. Else returns imwrite() 779 | //======================================================================== 780 | BOOL inline cvGENERIC::SaveFrms(Mat& frm, UINT& frmCnt) 781 | { 782 | if (!this->bCreateDir) return FALSE; 783 | 784 | stringstream ss; 785 | ss << this->VsubRoot << this->Vtitle << "_" << setfill('0') << setw(6) 786 | << frmCnt << ".jpg"; 787 | 788 | return imwrite(ss.str(), frm); 789 | } 790 | 791 | 792 | //======================================================================== 793 | // [OpenCV] Write a given Image 794 | //------------------------------------------------------------------------ 795 | // Write into the same root located by LoadImg() or by LoadVid() 796 | //======================================================================== 797 | BOOL inline cvGENERIC::SaveJPG(Mat& img) 798 | { 799 | if (this->Vroot.empty() || this->Vtitle.empty()) return false; 800 | 801 | stringstream ss; 802 | ss << Vroot << Vtitle << "_new.jpg"; 803 | 804 | return imwrite(ss.str(), img); 805 | } 806 | 807 | BOOL inline cvGENERIC::SavePNG(Mat& img) 808 | { 809 | if (this->Vroot.empty() || this->Vtitle.empty()) return false; 810 | 811 | vector pngPOLICY; 812 | pngPOLICY.push_back(CV_IMWRITE_PNG_COMPRESSION); 813 | pngPOLICY.push_back(0); 814 | 815 | stringstream ss; 816 | ss << Vroot << Vtitle << "_new.png"; 817 | 818 | return imwrite(ss.str(), img, pngPOLICY); 819 | } 820 | 821 | 822 | //======================================================================== 823 | // [OpenCV] Keyboard Message Handler 824 | //======================================================================== 825 | keyINFO inline cvGENERIC::ReadKey(UINT delay) 826 | { 827 | UINT key = waitKey(delay); 828 | keyINFO kINFO; 829 | 830 | if (key == 81 || key == 113) { kINFO.keyMsg = "[Q]"; kINFO.keyClass = kNA; } 831 | else if (key == 82 || key == 114) { kINFO.keyMsg = "[R]"; kINFO.keyClass = kNA; } 832 | else if (key == 67 || key == 99) { kINFO.keyMsg = "[C]"; kINFO.keyClass = kNA; } 833 | else if (key == 13) { kINFO.keyMsg = "[ENTER]"; kINFO.keyClass = kNA; } 834 | else if (key == 32) { kINFO.keyMsg = "[SPACE]"; kINFO.keyClass = kNA; } 835 | else if (key == 48) { kINFO.keyMsg = "[0]"; kINFO.keyClass = kNA; } 836 | else if (key == 49) { kINFO.keyMsg = "[1]"; kINFO.keyClass = kNUM; } 837 | else if (key == 50) { kINFO.keyMsg = "[2]"; kINFO.keyClass = kNUM; } 838 | else if (key == 51) { kINFO.keyMsg = "[3]"; kINFO.keyClass = kNUM; } 839 | else if (key == 52) { kINFO.keyMsg = "[4]"; kINFO.keyClass = kNUM; } 840 | else if (key == 53) { kINFO.keyMsg = "[5]"; kINFO.keyClass = kNUM; } 841 | else if (key == 54) { kINFO.keyMsg = "[6]"; kINFO.keyClass = kNUM; } 842 | else if (key == 55) { kINFO.keyMsg = "[7]"; kINFO.keyClass = kNUM; } 843 | else if (key == 56) { kINFO.keyMsg = "[8]"; kINFO.keyClass = kNUM; } 844 | else if (key == 57) { kINFO.keyMsg = "[9]"; kINFO.keyClass = kNA; } 845 | else if (key >= 0 && key < 128) { kINFO.keyMsg = (char)key; kINFO.keyClass = kNA; } 846 | else if (key == 7340032) { kINFO.keyMsg = "[F1]"; kINFO.keyClass = kFUNC; } 847 | else if (key == 7405568) { kINFO.keyMsg = "[F2]"; kINFO.keyClass = kFUNC; } 848 | else if (key == 7471104) { kINFO.keyMsg = "[F3]"; kINFO.keyClass = kFUNC; } 849 | else if (key == 7536640) { kINFO.keyMsg = "[F4]"; kINFO.keyClass = kFUNC; } 850 | else if (key == 7602176) { kINFO.keyMsg = "[F5]"; kINFO.keyClass = kFUNC; } 851 | else if (key == 7667712) { kINFO.keyMsg = "[F6]"; kINFO.keyClass = kFUNC; } 852 | else if (key == 7733248) { kINFO.keyMsg = "[F7]"; kINFO.keyClass = kFUNC; } 853 | else if (key == 7798784) { kINFO.keyMsg = "[F8]"; kINFO.keyClass = kFUNC; } 854 | else if (key == 7864320) { kINFO.keyMsg = "[F9]"; kINFO.keyClass = kNA; } 855 | else if (key == 7929856) { kINFO.keyMsg = "[F10]"; kINFO.keyClass = kNA; } 856 | else if (key == 7995392) { kINFO.keyMsg = "[F11]"; kINFO.keyClass = kNA; } 857 | else if (key == 8060928) { kINFO.keyMsg = "[F12]"; kINFO.keyClass = kNA; } 858 | else if (key == 2424832) { kINFO.keyMsg = "[<]"; kINFO.keyClass = kNA; } 859 | else if (key == 2555904) { kINFO.keyMsg = "[>]"; kINFO.keyClass = kNA; } 860 | else if (key == 2490368) { kINFO.keyMsg = "[^]"; kINFO.keyClass = kNA; } 861 | else if (key == 2621440) { kINFO.keyMsg = "[v]"; kINFO.keyClass = kNA; } 862 | else { kINFO.keyMsg = ""; kINFO.keyClass = kNA; } 863 | 864 | return kINFO; 865 | } 866 | 867 | 868 | vector inline cvGENERIC::QueryActiveThread(INT* threadStat) 869 | { 870 | vector ACTIVE; 871 | 872 | for (register UINT id = 0; id < maxThreads; ++id) 873 | if (threadStat[id] == thread_ACTIVE) ACTIVE.push_back(id); 874 | 875 | return ACTIVE; 876 | } 877 | 878 | VOID inline cvGENERIC::ReserveThreadStat(INT threadStat[], INT threadStatOld[]) 879 | { 880 | for (register UINT id = 0; id < maxThreads; ++id) 881 | threadStatOld[id] = threadStat[id]; 882 | } 883 | 884 | 885 | BOOL inline cvGENERIC::QueryThreadChange(INT threadStat[], INT threadStatOld[]) 886 | { 887 | BOOL isChanged = FALSE; 888 | 889 | for (register UINT id = 0; id < maxThreads; ++id) 890 | if (threadStat[id] != threadStatOld[id]) isChanged = TRUE; 891 | 892 | return isChanged; 893 | } 894 | 895 | 896 | threadINFO inline cvGENERIC::WarpThreadPool(string& threadName) 897 | { 898 | //------------------------ 899 | // Temporal Method 900 | // [Fn] -> [n] -> n 901 | //------------------------ 902 | threadName.erase(1, 1); 903 | char numPart = threadName[1]; 904 | UINT num = atoi(&numPart); 905 | UINT nth = num - 1; 906 | 907 | threadINFO tINFO; 908 | 909 | //------------------------------------------------------- 910 | // threads isn't empty 911 | //------------------------------------------------------- 912 | if (this->threadsNUM > 0) 913 | { 914 | if (this->threads[nth] != "") 915 | { // delete the existing 916 | 917 | this->threads[nth] = ""; 918 | this->threadsNUM--; 919 | tINFO.Destruct(nth, threadName); 920 | } 921 | else 922 | { // insert the new 923 | 924 | this->threads[nth] = threadName; 925 | this->threadsNUM++; 926 | tINFO.Create(nth, threadName); 927 | } 928 | 929 | } 930 | 931 | //------------------------------------------------------- 932 | // threads is empty 933 | //------------------------------------------------------- 934 | else 935 | { // insert the new 936 | 937 | this->threads[nth] = threadName; 938 | this->threadsNUM++; 939 | tINFO.Create(nth, threadName); 940 | } 941 | 942 | return tINFO; 943 | } 944 | 945 | threadINFO inline cvGENERIC::ControlThread(string& threadNum) 946 | { 947 | //------------------------- 948 | // Temporal Method 949 | // [Fn] -> [n] -> n 950 | //------------------------- 951 | char numPart = threadNum[1]; 952 | UINT num = atoi(&numPart); 953 | UINT nth = num - 1; 954 | 955 | threadINFO tINFO; 956 | 957 | if (nth < 0) 958 | { // pressed [0] 959 | 960 | tINFO.Clear(); 961 | return tINFO; 962 | } 963 | 964 | //------------------------------------------------------- 965 | // threads isn't empty 966 | //------------------------------------------------------- 967 | if (this->threadsNUM > 0) 968 | { 969 | if(this->threads[nth] != "") 970 | { // control the match 971 | 972 | tINFO.Control(nth, threadNum); 973 | } 974 | 975 | else 976 | { // nothing matched 977 | 978 | tINFO.Clear(); 979 | } 980 | } 981 | 982 | //------------------------------------------------------- 983 | // threads is empty 984 | //------------------------------------------------------- 985 | else 986 | { 987 | tINFO.Clear(); 988 | } 989 | 990 | return tINFO; 991 | } -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/fastcluster.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/fastcluster.h -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/fusion.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "fusion.h" 3 | 4 | 5 | namespace cmt { 6 | 7 | BOOL Fusion::preferFirst( 8 | const vector& pointsFirst, 9 | const vector& classesFirst, 10 | const vector& pointsSecond, 11 | const vector& classesSecond, 12 | vector& pointsFused, 13 | vector& classesFused 14 | ){ 15 | 16 | if ( 17 | // (pointsFirst.size() == 0) || 18 | (pointsSecond.size() == 0) || 19 | (pointsSecond.size() != classesSecond.size()) || 20 | (pointsFirst.size() != classesFirst.size()) 21 | ) 22 | { 23 | return FALSE; 24 | } 25 | 26 | pointsFused = pointsFirst; 27 | classesFused = classesFirst; 28 | 29 | for (register UINT id2nd = 0; id2nd < pointsSecond.size(); ++id2nd) 30 | { 31 | register int secondClass = classesSecond[id2nd]; 32 | 33 | bool bOverlap = false; 34 | for (register UINT id1st = 0; id1st < pointsFirst.size(); id1st++) 35 | { 36 | register int firstClass = classesFirst[id1st]; 37 | if (firstClass == secondClass) bOverlap = true; 38 | } 39 | 40 | if (!bOverlap) 41 | { 42 | pointsFused.push_back(pointsSecond[id2nd]); 43 | classesFused.push_back(secondClass); 44 | } 45 | } 46 | 47 | return TRUE; 48 | } 49 | 50 | } // namespace cmt 51 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/fusion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Fusion { 9 | 10 | //----------------------------------------------------------------- 11 | public: 12 | //----------------------------------------------------------------- 13 | 14 | BOOL preferFirst( 15 | const vector& pointsFirst, 16 | const vector& classesFirst, 17 | const vector& pointsSecond, 18 | const vector& classesSecond, 19 | vector& pointsFused, 20 | vector& classesFused 21 | ); 22 | 23 | }; 24 | 25 | } // namespace CMT 26 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/matcher.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/matcher.cpp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/matcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Matcher { 9 | 10 | //----------------------------------------------------------------- 11 | public: 12 | //----------------------------------------------------------------- 13 | 14 | Matcher() : thrDist(0.25), thrRatio(0.8), thrCutoff(20) {}; 15 | 16 | void initialize( 17 | const vector& vectorsFG, 18 | const MatND& database, 19 | const vector& classes, 20 | const int& numPointsBG 21 | ); 22 | 23 | BOOL matchGlobal( 24 | const vector& keypoints, 25 | const MatND& descriptors, 26 | vector& pointsMatched, 27 | vector& classesMatched 28 | ); 29 | 30 | BOOL matchLocal( 31 | const vector& keypoints, 32 | const MatND& descriptors, 33 | const float& scale, 34 | const float& rotation, 35 | const Point2f& center, 36 | vector& pointsMatched, 37 | vector& classesMatched 38 | ); 39 | 40 | 41 | //----------------------------------------------------------------- 42 | private: 43 | //----------------------------------------------------------------- 44 | 45 | vector vectorsFG; 46 | MatND database; 47 | vector classes; 48 | int descLength; 49 | int numPointsBG; 50 | Ptr bfmatcher; 51 | float thrDist; 52 | float thrRatio; 53 | float thrCutoff; 54 | 55 | }; 56 | 57 | } // namespace CMT 58 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/BRLNSB.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/BRLNSB.TTF -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/BRLNSDB.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/BRLNSDB.TTF -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/BRLNSR.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/BRLNSR.TTF -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/cmtDlg.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/cmtDlg.ico -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/cmtDlg.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/cmtDlg.rc2 -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet.pptx -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/0.png -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F1_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F1_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F1_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F1_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F2_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F2_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F2_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F2_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F3_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F3_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F3_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F3_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F4_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F4_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F4_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F4_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F5_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F5_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F5_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F5_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F6_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F6_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F6_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F6_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F7_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F7_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F7_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F7_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F8_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F8_0.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/F8_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/F8_1.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/Fn_LIST.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/Fn_LIST.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/Fn_x.bmp: -------------------------------------------------------------------------------- 1 | BMN$6(77$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/making.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/making.png -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/making2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/making2.png -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/res/icoSet/pannel.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/res/icoSet/pannel.bmp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/resource.h -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/stdafx.cpp -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/stdafx.h -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.0/cmtDlg/targetver.h -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/tracker.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "tracker.h" 3 | 4 | 5 | namespace cmt { 6 | 7 | BOOL Tracker::track( 8 | const Mat& imPrev, 9 | const Mat& imGray, 10 | const vector& pointsPrev, 11 | vector& pointsTracked, 12 | vector& status 13 | ){ 14 | 15 | if (pointsPrev.size() > 0) 16 | { 17 | vector err; 18 | 19 | //------------------------------------------------------------------------------------------ 20 | // Calculate [Forward Optical Flow] 21 | //------------------------------------------------------------------------------------------ 22 | calcOpticalFlowPyrLK(imPrev, imGray, pointsPrev, pointsTracked, status, err); 23 | 24 | //------------------------------------------------------------------------------------------ 25 | // Calculate [Backward Optical Flow] 26 | //------------------------------------------------------------------------------------------ 27 | vector pointsBack; 28 | vector statusBack; 29 | vector errBack; 30 | 31 | calcOpticalFlowPyrLK(imGray, imPrev, pointsTracked, pointsBack, statusBack, errBack); 32 | 33 | 34 | //------------------------------------------------------------------------------------------ 35 | // Remove [Mal-tracked points] 36 | //------------------------------------------------------------------------------------------ 37 | for (register UINT it = pointsPrev.size() - 1; it > 0; --it) 38 | { 39 | float l2norm = norm(pointsBack[it] - pointsPrev[it]); 40 | bool bPointsFly = l2norm > thrPointsFly; 41 | 42 | if (bPointsFly || !status[it] || !statusBack[it]) 43 | { 44 | pointsTracked.erase(pointsTracked.begin() + it); 45 | status[it] = 0; 46 | } 47 | } 48 | 49 | return TRUE; 50 | } 51 | 52 | else 53 | { 54 | return FALSE; 55 | } 56 | } 57 | 58 | } // namespace cmt 59 | -------------------------------------------------------------------------------- /Release v1.0/cmtDlg/tracker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Tracker { 9 | //----------------------------------------------------------------- 10 | public: 11 | //----------------------------------------------------------------- 12 | 13 | Tracker() : thrPointsFly(30) {}; 14 | 15 | BOOL track( 16 | const Mat& imPrev, 17 | const Mat& imGray, 18 | const vector& pointsPrev, 19 | vector& pointsTracked, 20 | vector& status 21 | ); 22 | 23 | 24 | //----------------------------------------------------------------- 25 | private: 26 | //----------------------------------------------------------------- 27 | 28 | float thrPointsFly; 29 | 30 | }; 31 | 32 | } // namespace CMT 33 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30723.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cmtDlg", "cmtDlg\cmtDlg.vcxproj", "{76003894-29EE-417B-BCCA-EDB6BD12D527}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Debug|Win32.Build.0 = Debug|Win32 16 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Release|Win32.ActiveCfg = Release|Win32 17 | {76003894-29EE-417B-BCCA-EDB6BD12D527}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.res -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/cl.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/cl.command.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/cmtDlg.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit 2 | Debug|Win32|D:\cmtDlg\| 3 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/rc.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/rc.command.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/rc.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/rc.read.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/cmtDlg.tlog/rc.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/cmtDlg.tlog/rc.write.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Debug/vc120.idb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Debug/vc120.idb -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/OpenCV300D.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | D:\OpenCV300\build\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); 7 | D:\OpenCV300\build\x86\vc12\lib;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86); 8 | 9 | 10 | 11 | opencv_world300d.lib; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/OpenCV300R.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | D:\OpenCV300\build\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); 7 | D:\OpenCV300\build\x86\vc12\lib;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86); 8 | 9 | 10 | 11 | opencv_world300.lib; 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.res -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/cl.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/cl.command.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/cmtDlg.lastbuildstate: -------------------------------------------------------------------------------- 1 | #TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit 2 | Release|Win32|D:\cmtDlg\| 3 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/rc.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/rc.command.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/rc.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/rc.read.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/Release/cmtDlg.tlog/rc.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/Release/cmtDlg.tlog/rc.write.1.tlog -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmt.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/cmt.cpp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | #include "matcher.h" 6 | #include "tracker.h" 7 | #include "fusion.h" 8 | #include "consensus.h" 9 | 10 | namespace cmt { 11 | 12 | class CMT { 13 | 14 | public: 15 | 16 | CMT(const UINT& myID, const Ptr& detector, 17 | const DOUBLE& distCOEFF, const DOUBLE& distThresh, 18 | const string& notePath 19 | ){ 20 | this->myID = myID; 21 | this->detector = detector; 22 | this->isInit = FALSE; 23 | this->isRetrying = FALSE; 24 | 25 | this->frmCnt = 0; // Currently not in use 26 | this->distCoeff = distCOEFF; 27 | this->distThresh = distThresh; 28 | this->posGrowth = 0; 29 | 30 | this->notePath = notePath; 31 | this->notePath += LocalTimeMS(); 32 | this->notePath += " ActiveMASS F"; 33 | this->notePath += to_string(1 + this->myID); 34 | this->notePath += ".txt"; 35 | }; 36 | 37 | ~CMT() 38 | { 39 | this->noteFile.close(); 40 | }; 41 | 42 | 43 | //---------------------------------------------------------------------------- 44 | VOID supplyKeyPoints(const vector& keypoints); 45 | VOID configDist(const BOOL& distCoeff, const BOOL& g_distThresh); 46 | VOID openNoteFile(VOID); 47 | 48 | VOID initialize(const Mat& imGray, const Rect& rect); 49 | BOOL processFrame(const Mat& imGray); 50 | 51 | BOOL determineFailure(Point2f& center); 52 | BOOL determineFailure(Point2f verticle[]); 53 | VOID recoverArchive(VOID); 54 | VOID distJournal(VOID); 55 | 56 | 57 | //---------------------------------------------------------------------------- 58 | Matcher matcher; 59 | Tracker tracker; 60 | Fusion fusion; 61 | Consensus consensus; 62 | 63 | Mat imPrev; 64 | Point2f center; 65 | Size2f sizeInitial; 66 | vector pointsActive; 67 | vector classesActive; 68 | RotatedRect bbRotated; 69 | 70 | 71 | //---------------------------------------------------------------------------- 72 | UINT myID; 73 | BOOL isInit; 74 | BOOL isRetrying; 75 | 76 | INT xLimit, yLimit; 77 | BOOL isVisible; 78 | Mat imArchive; 79 | vector pointsArchive; 80 | vector classesArchive; 81 | 82 | UINT frmCnt; 83 | ofstream noteFile; 84 | string notePath; 85 | 86 | 87 | //---------------------------------------------------------------------------- 88 | DOUBLE posChange; 89 | INT posGrowth; 90 | 91 | Point2f posCurrent, posPrev; 92 | 93 | 94 | private: 95 | 96 | Ptr detector; 97 | Ptr descriptor; 98 | vector keypoints; 99 | 100 | DOUBLE distCoeff, distThresh; 101 | 102 | }; 103 | 104 | } // namespace CMT 105 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmtDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/cmtDlg.cpp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmtDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/cmtDlg.h -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmtDlg.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/cmtDlg.rc -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmtDlg.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {76003894-29EE-417B-BCCA-EDB6BD12D527} 15 | cmtDlg 16 | MFCProj 17 | 18 | 19 | 20 | Application 21 | true 22 | v120 23 | Unicode 24 | Dynamic 25 | 26 | 27 | Application 28 | false 29 | v120 30 | true 31 | Unicode 32 | Dynamic 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | true 48 | $(VC_SourcePath); 49 | 50 | 51 | false 52 | $(VC_SourcePath); 53 | 54 | 55 | 56 | Use 57 | Level3 58 | Disabled 59 | _SCL_SECURE_NO_WARNINGS;WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 60 | false 61 | 62 | 63 | Windows 64 | true 65 | 66 | 67 | false 68 | true 69 | _DEBUG;%(PreprocessorDefinitions) 70 | 71 | 72 | 0x0412 73 | _DEBUG;%(PreprocessorDefinitions) 74 | $(IntDir);%(AdditionalIncludeDirectories) 75 | 76 | 77 | 78 | 79 | Level3 80 | Use 81 | Disabled 82 | true 83 | true 84 | _SCL_SECURE_NO_WARNINGS;WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 85 | false 86 | 87 | 88 | Windows 89 | true 90 | true 91 | true 92 | 93 | 94 | false 95 | true 96 | NDEBUG;%(PreprocessorDefinitions) 97 | 98 | 99 | 0x0412 100 | NDEBUG;%(PreprocessorDefinitions) 101 | $(IntDir);%(AdditionalIncludeDirectories) 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | Create 136 | Create 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmtDlg.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {3b59f1b5-291f-4a4b-b729-d4544d21cae2} 18 | 19 | 20 | {8d4197c1-a426-47a0-87a0-5705369e8c77} 21 | 22 | 23 | {8e83d2ef-584e-464d-91a7-94dfe96995eb} 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 헤더 파일 32 | 33 | 34 | 헤더 파일 35 | 36 | 37 | 헤더 파일 38 | 39 | 40 | 헤더 파일 41 | 42 | 43 | 헤더 파일 44 | 45 | 46 | Robinus\header 47 | 48 | 49 | Robinus\header 50 | 51 | 52 | Robinus\header 53 | 54 | 55 | Robinus\header 56 | 57 | 58 | Robinus\header 59 | 60 | 61 | Robinus\header 62 | 63 | 64 | Robinus\header 65 | 66 | 67 | Robinus\header 68 | 69 | 70 | Robinus\header 71 | 72 | 73 | Robinus\header 74 | 75 | 76 | Robinus\header 77 | 78 | 79 | 80 | 81 | 소스 파일 82 | 83 | 84 | 소스 파일 85 | 86 | 87 | 소스 파일 88 | 89 | 90 | Robinus\source 91 | 92 | 93 | Robinus\source 94 | 95 | 96 | Robinus\source 97 | 98 | 99 | Robinus\source 100 | 101 | 102 | Robinus\source 103 | 104 | 105 | Robinus\source 106 | 107 | 108 | Robinus\source 109 | 110 | 111 | 112 | 113 | 리소스 파일 114 | 115 | 116 | 117 | 118 | 리소스 파일 119 | 120 | 121 | 122 | 123 | 리소스 파일 124 | 125 | 126 | 리소스 파일 127 | 128 | 129 | 리소스 파일 130 | 131 | 132 | 리소스 파일 133 | 134 | 135 | 리소스 파일 136 | 137 | 138 | 리소스 파일 139 | 140 | 141 | 리소스 파일 142 | 143 | 144 | 리소스 파일 145 | 146 | 147 | 리소스 파일 148 | 149 | 150 | 리소스 파일 151 | 152 | 153 | 리소스 파일 154 | 155 | 156 | 리소스 파일 157 | 158 | 159 | 리소스 파일 160 | 161 | 162 | 리소스 파일 163 | 164 | 165 | 리소스 파일 166 | 167 | 168 | 리소스 파일 169 | 170 | 171 | 리소스 파일 172 | 173 | 174 | 리소스 파일 175 | 176 | 177 | 리소스 파일 178 | 179 | 180 | 리소스 파일 181 | 182 | 183 | 리소스 파일 184 | 185 | 186 | 리소스 파일 187 | 188 | 189 | 리소스 파일 190 | 191 | 192 | 리소스 파일 193 | 194 | 195 | 리소스 파일 196 | 197 | 198 | 리소스 파일 199 | 200 | 201 | 리소스 파일 202 | 203 | 204 | 리소스 파일 205 | 206 | 207 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmtDlgDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/cmtDlgDlg.cpp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cmtDlgDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/cmtDlgDlg.h -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/common.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "common.h" 3 | 4 | 5 | namespace cmt { 6 | 7 | //TODO: Check for even/uneven number of elements 8 | //The order of the elements of A is changed 9 | float median(vector& A) 10 | { 11 | 12 | if (A.size() == 0) 13 | { 14 | return numeric_limits::quiet_NaN(); 15 | } 16 | 17 | nth_element(A.begin(), A.begin() + A.size() / 2, A.end()); 18 | 19 | return A[A.size() / 2]; 20 | } 21 | 22 | Point2f rotate(const Point2f& v, const float& angle) 23 | { 24 | Point2f r; 25 | r.x = cos(angle) * v.x - sin(angle) * v.y; 26 | r.y = sin(angle) * v.x + cos(angle) * v.y; 27 | 28 | return r; 29 | } 30 | 31 | } /* namespace cmt */ 32 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cvGeneric.hpp" 4 | 5 | using namespace cv; 6 | using namespace std; 7 | 8 | namespace cmt { 9 | 10 | float median(vector& A); 11 | Point2f rotate(const Point2f& v, const float& angle); 12 | 13 | template 14 | int sgn(T& x) 15 | { 16 | if (x >= 0) return 1; 17 | else return -1; 18 | } 19 | 20 | } // namespace cmt 21 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/consensus.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "consensus.h" 3 | #include "fastcluster.h" 4 | 5 | 6 | namespace cmt { 7 | 8 | VOID Consensus::configDeform(const BOOL& isScale, const BOOL& isRotation) 9 | { 10 | this->isScale = isScale; 11 | this->isRotation = isRotation; 12 | } 13 | 14 | 15 | //--------------------------------------------------------------------------------------------------- 16 | // Calculate correspondences from foreground Constellation 17 | // Correlation of 2 vectors : normsPairwise, anglesPairwise 18 | //--------------------------------------------------------------------------------------------------- 19 | void Consensus::initialize(const vector& vectorsFG) 20 | { 21 | this->vectorsFG = vectorsFG; 22 | UINT numPointsFG = vectorsFG.size(); 23 | 24 | this->normsPairwise = MatND(Size(numPointsFG, numPointsFG), CV_32FC1); 25 | this->anglesPairwise = MatND(Size(numPointsFG, numPointsFG), CV_32FC1); 26 | 27 | for (register UINT i = 0; i < numPointsFG; ++i) 28 | { 29 | for (register UINT j = 0; j < numPointsFG; ++j) 30 | { 31 | Point2f v = vectorsFG[i] - vectorsFG[j]; 32 | 33 | float dist = norm(v); 34 | float angleCurrent = atan2(v.y, v.x); 35 | 36 | this->normsPairwise.at(i, j) = dist; 37 | this->anglesPairwise.at(i, j) = angleCurrent; 38 | } 39 | } 40 | } 41 | 42 | 43 | //--------------------------------------------------------------------------------------------------- 44 | // Estimate the changes in Scale and Rotation of pointsFused from the initial Constellation 45 | //--------------------------------------------------------------------------------------------------- 46 | BOOL Consensus::estimateScaleRotation( 47 | const vector& points, 48 | const vector& classes, 49 | float& scale, 50 | float& rotation 51 | ){ 52 | 53 | vector changesScale, changesAngle; 54 | 55 | UINT sizePoints = points.size(); 56 | if (sizePoints == 0) 57 | { 58 | return FALSE; 59 | } 60 | 61 | for (register UINT i = 0; i < sizePoints; ++i) 62 | { 63 | for (register UINT j = 0; j < sizePoints; j++) 64 | { 65 | if (classes[i] != classes[j]) 66 | { 67 | Point2f v = points[i] - points[j]; 68 | 69 | if (isScale) 70 | { 71 | float distCurrent = norm(v); 72 | float distInitial = this->normsPairwise.at(classes[i], classes[j]); 73 | float changeScale = distCurrent / distInitial; 74 | changesScale.push_back(changeScale); 75 | } 76 | 77 | if (isRotation) 78 | { 79 | float angleCurrent = atan2(v.y, v.x); 80 | float angleInitial = this->anglesPairwise.at(classes[i], classes[j]); 81 | float changeAngle = angleCurrent - angleInitial; 82 | 83 | if (fabs(changeAngle) > CV_PI) // Fix long-way anglesPairwise 84 | changeAngle = sgn(changeAngle) * 2 * CV_PI + changeAngle; 85 | 86 | changesAngle.push_back(changeAngle); 87 | } 88 | } 89 | } 90 | } 91 | 92 | if (changesScale.size() < 2) scale = 1; 93 | else scale = median(changesScale); 94 | 95 | if (changesAngle.size() < 2) rotation = 0; 96 | else rotation = median(changesAngle); 97 | 98 | return TRUE; 99 | } 100 | 101 | 102 | BOOL Consensus::findConsensus( 103 | const vector& points, 104 | const vector& classes, 105 | const float& scale, 106 | const float& rotation, 107 | Point2f& center, 108 | vector& pointsInlier, 109 | vector& classesInlier 110 | ){ 111 | 112 | UINT sizePoints = points.size(); 113 | 114 | //--------------------------------------------------------------------------------------------------- 115 | // If no points are available, reteurn nan 116 | //--------------------------------------------------------------------------------------------------- 117 | if (sizePoints == 0) 118 | { 119 | center.x = numeric_limits::quiet_NaN(); 120 | center.y = numeric_limits::quiet_NaN(); 121 | 122 | return FALSE; 123 | } 124 | 125 | 126 | //--------------------------------------------------------------------------------------------------- 127 | // Compute votes 128 | //--------------------------------------------------------------------------------------------------- 129 | vector votes(points.size()); 130 | 131 | for (register UINT it = 0; it < sizePoints; ++it) 132 | { // votes : pointsFused - DeformsFG 133 | votes[it] = points[it] - scale * rotate(vectorsFG[classes[it]], rotation); 134 | } 135 | 136 | t_index N = sizePoints; 137 | 138 | //This is a lot of memory, so we put it on the heap 139 | float* D = new float[N*(N - 1) / 2]; 140 | 141 | cluster_result Z(N - 1); 142 | 143 | //--------------------------------------------------------------------------------------------------- 144 | // Compute pairwise distances between votes 145 | //--------------------------------------------------------------------------------------------------- 146 | register int index = 0; 147 | for (register UINT it = 0; it < sizePoints; ++it) 148 | { 149 | for (register UINT j = it + 1; j < sizePoints; j++) 150 | { 151 | //TODO: This index calculation is correct, but is it a good thing? 152 | //int index = it * (points.size() - 1) - (it*it + it) / 2 + j - 1; 153 | D[index] = norm(votes[it] - votes[j]); 154 | index++; 155 | } 156 | } 157 | MST_linkage_core(N, D, Z); 158 | 159 | union_find nodes(N); 160 | 161 | //--------------------------------------------------------------------------------------------------- 162 | // Sort linkage by distance ascending 163 | //--------------------------------------------------------------------------------------------------- 164 | std::stable_sort(Z[0], Z[N - 1]); 165 | 166 | //S are cluster sizes 167 | int* S = new int[2 * N - 1]; 168 | 169 | // TODO: Why does this loop go to 2*N-1? 170 | // Shouldn't it be simply N? Everything > N gets overwritten later 171 | for (register int it = 0; it < (2*N - 1); ++it) S[it] = 1; 172 | 173 | // After the loop ends, parent contains the index of the last cluster 174 | t_index parent = 0; 175 | for (node const * NN = Z[0]; NN != Z[N - 1]; ++NN) 176 | { 177 | // Get two data points whose clusters are merged in step it. 178 | // Find the cluster identifiers for these points. 179 | t_index node1 = nodes.Find(NN->node1); 180 | t_index node2 = nodes.Find(NN->node2); 181 | 182 | // Merge the nodes in the union-find data structure by making them 183 | // children of a new node 184 | // if the distance is appropriate 185 | if (NN->dist < thrCutoff) 186 | { 187 | parent = nodes.Union(node1, node2); 188 | S[parent] = S[node1] + S[node2]; 189 | } 190 | } 191 | 192 | //--------------------------------------------------------------------------------------------------- 193 | // Get cluster labels 194 | //--------------------------------------------------------------------------------------------------- 195 | int* T = new int[N]; 196 | for (t_index it = 0; it < N; ++it) 197 | T[it] = nodes.Find(it); 198 | 199 | // Find largest cluster 200 | int S_max = distance(S, max_element(S, S + 2 * N - 1)); 201 | 202 | // Find inliers, compute center of votes 203 | pointsInlier.reserve(S[S_max]); 204 | classesInlier.reserve(S[S_max]); 205 | center.x = center.y = 0; 206 | 207 | for (register UINT it = 0; it < sizePoints; ++it) 208 | { 209 | // If point is in consensus cluster 210 | if (T[it] == S_max) 211 | { 212 | pointsInlier.push_back(points[it]); 213 | classesInlier.push_back(classes[it]); 214 | center.x += votes[it].x; 215 | center.y += votes[it].y; 216 | } 217 | } 218 | 219 | center.x /= pointsInlier.size(); 220 | center.y /= pointsInlier.size(); 221 | 222 | delete[] D; 223 | delete[] S; 224 | delete[] T; 225 | 226 | return TRUE; 227 | } 228 | 229 | } // namespace cmt 230 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/consensus.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Consensus { 9 | 10 | public: 11 | 12 | Consensus() : isScale(FALSE), isRotation(TRUE), thrCutoff(20) {}; 13 | 14 | VOID configDeform(const BOOL& isScale, const BOOL& isRotation); 15 | 16 | VOID initialize( 17 | const vector& vectorsFG 18 | ); 19 | 20 | BOOL estimateScaleRotation( 21 | const vector& points, 22 | const vector& classes, 23 | float& scale, 24 | float& rotation 25 | ); 26 | 27 | BOOL findConsensus( 28 | const vector& points, 29 | const vector& classes, 30 | const float& scale, 31 | const float& rotation, 32 | Point2f& center, 33 | vector& pointsInlier, 34 | vector& classesInlier 35 | ); 36 | 37 | 38 | private: 39 | 40 | BOOL isScale, isRotation; 41 | float thrCutoff; 42 | vector vectorsFG; 43 | MatND normsPairwise; 44 | MatND anglesPairwise; 45 | 46 | }; 47 | 48 | } // namespace cmt 49 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cvColorDef.hpp: -------------------------------------------------------------------------------- 1 | // Robinus Fuser. 2015-09-25 06:15 2 | // Electronics Dept. Konkuk Univ. South Korea 3 | // fordicus@naver.com 4 | 5 | 6 | #pragma once 7 | //====================================================== 8 | #define winRGB_Black RGB(255, 255, 255) 9 | #define winRGB_White RGB(0, 0, 0) 10 | #define winRGB_DKGray RGB(48, 48, 48) 11 | #define winRGB_Aquamarine RGB(127, 255, 212) 12 | #define winRGB_LightCoral RGB(240, 128, 128) 13 | #define winRGB_Light RGB(238, 221, 130) 14 | //------------------------------------------------------ 15 | #define winRGB_Tomato RGB(220, 20, 60) 16 | #define winRGB_PaleGreen RGB(152, 251, 152) 17 | #define winRGB_DeepSkyBlue RGB(0, 191, 255) 18 | #define winRGB_Violet RGB(238, 130, 238) 19 | #define winRGB_Orange RGB(255, 165, 0) 20 | #define winRGB_LemonChiffon RGB(255, 250, 205) 21 | #define winRGB_Cyan RGB(0, 255, 255) 22 | #define winRGB_Pink RGB(255, 192, 203) 23 | 24 | //====================================================== 25 | #define cvBGR_Black Scalar(0, 0, 0) 26 | #define cvBGR_White Scalar(255, 255, 255) 27 | #define cvBGR_Green Scalar(0, 255, 0) 28 | #define cvBGR_Sky Scalar(255, 255, 0) 29 | #define cvBGR_Yellow Scalar(0, 255, 255) 30 | #define cvBGR_Red Scalar(0, 0, 255) 31 | //------------------------------------------------------ 32 | #define cvBGR_Tomato Scalar(60, 20, 220) 33 | #define cvBGR_PaleGreen Scalar(152, 251, 152) 34 | #define cvBGR_DeepSkyBlue Scalar(255, 191, 0) 35 | #define cvBGR_Violet Scalar(238, 130, 238) 36 | #define cvBGR_Orange Scalar(0, 165, 255) 37 | #define cvBGR_LemonChiffon Scalar(205, 250, 255) 38 | #define cvBGR_Cyan Scalar(255, 255, 0) 39 | #define cvBGR_Pink Scalar(203, 192, 255) -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/cvGeneric.hpp: -------------------------------------------------------------------------------- 1 | // Robinus Fuser. 2015-09-25 06:15 2 | // Electronics Dept. Konkuk Univ. South Korea 3 | // fordicus@naver.com 4 | 5 | /* 6 | GlobalInits() 7 | SecureEndThread() 8 | GlobalExits() 9 | 10 | QueryActiveThread() 11 | QueryThreadToEnd() 12 | ReserveThreadStat() 13 | QueryThreadChange() 14 | 15 | QueryWinUserName() 16 | LocalTime() 17 | LocalTimeMS() 18 | 19 | class threadINFO 20 | class keyINFO 21 | class cvGENERIC 22 | */ 23 | 24 | 25 | #pragma once 26 | #include 27 | #include "cvColorDef.hpp" 28 | #include "gcPreprocess.hpp" 29 | #include "gcProfile.hpp" 30 | 31 | using namespace cv; 32 | 33 | 34 | //============================================================================ 35 | // Global Variables & Definitions 36 | //---------------------------------------------------------------------------- 37 | // refer to "stdafx.cpp" 38 | //============================================================================ 39 | extern VideoCapture g_cap; 40 | extern VideoWriter g_writer; 41 | extern BOOL g_runningONE; 42 | extern vector g_keypoint; 43 | extern BOOL g_testDetector; 44 | extern UINT g_selDetector; 45 | extern Ptr g_detector; 46 | #define detector_GFTT 0 47 | #define detector_FAST 1 48 | //---------------------------------------------------------------------------- 49 | extern string g_wnd; 50 | extern Mat g_frm, g_frmToShow, 51 | g_frmGray, g_frmGrays[maxThreads]; 52 | extern vector> g_keypoints; 53 | extern Rect2f g_Rect; 54 | 55 | extern BOOL g_isScale; 56 | extern BOOL g_isRotation; 57 | extern FLOAT g_distCoeff, g_distThresh; 58 | extern string g_notePath; 59 | extern INT g_captureStat; 60 | #define capture_IDLE -1 61 | #define capture_RUNNING 1 62 | 63 | extern vector> g_pointsActive; 64 | extern Point2f g_verticles[maxThreads][4]; 65 | 66 | extern UINT g_IdxThread; 67 | extern BOOL g_isRedraw; 68 | 69 | extern CWinThread* pThreads[maxThreads]; 70 | extern CEvent warpEvents[maxThreads]; 71 | extern CEvent controlEvents[maxThreads]; 72 | extern CEvent allowProcess[maxThreads]; 73 | extern CEvent readyToDraw[maxThreads]; 74 | extern UINT posChange[maxThreads]; 75 | extern UINT retryCnt[maxThreads]; 76 | #define maximum_RETRY 10 77 | 78 | extern INT threadStat[maxThreads]; 79 | extern INT threadStatOld[maxThreads]; 80 | #define thread_VOID -1 81 | #define thread_IDLE 0 82 | #define thread_ACTIVE 1 83 | 84 | 85 | //============================================================================ 86 | // Global Functions 87 | //============================================================================ 88 | VOID inline GlobalInits(VOID) 89 | { 90 | g_captureStat = capture_IDLE; 91 | g_testDetector = FALSE; 92 | 93 | vector vecPoint_VOID; 94 | Point2f aPoint2f; 95 | vecPoint_VOID.push_back(aPoint2f); 96 | 97 | vector vecKeyPoint_VOID; 98 | KeyPoint aKeyPoint; 99 | vecKeyPoint_VOID.push_back(aKeyPoint); 100 | 101 | 102 | for (register UINT id = 0; id < maxThreads; ++id) 103 | { 104 | g_keypoints.push_back(vecKeyPoint_VOID); 105 | g_pointsActive.push_back(vecPoint_VOID); // Access from threadCMT() 106 | pThreads[id] = NULL; 107 | warpEvents[id].ResetEvent(); 108 | controlEvents[id].ResetEvent(); 109 | allowProcess[id].ResetEvent(); 110 | readyToDraw[id].ResetEvent(); 111 | threadStat[id] = thread_VOID; 112 | retryCnt[id] = 0; 113 | } 114 | } 115 | 116 | 117 | vector inline QueryThreadToEnd(INT threadStat[]) 118 | { 119 | vector nonVOID; 120 | 121 | for (register UINT id = 0; id < maxThreads; ++id) 122 | if (threadStat[id] != thread_VOID) nonVOID.push_back(id); 123 | 124 | return nonVOID; 125 | } 126 | 127 | 128 | 129 | VOID inline SecureEndThread(INT threadStat[]) 130 | { 131 | vector ThreadToEnd = QueryThreadToEnd(threadStat); 132 | 133 | while (ThreadToEnd.size() > 0) 134 | { 135 | for (register UINT id = 0; id < ThreadToEnd.size(); ++id) 136 | warpEvents[ThreadToEnd[id]].SetEvent(); 137 | 138 | ThreadToEnd = QueryThreadToEnd(threadStat); 139 | } 140 | } 141 | 142 | 143 | VOID inline GlobalExits(VOID) 144 | { 145 | g_writer.release(); 146 | g_cap.release(); 147 | g_captureStat = capture_IDLE; 148 | SecureEndThread(threadStat); 149 | cv::destroyAllWindows(); 150 | g_runningONE = FALSE; 151 | } 152 | 153 | 154 | vector inline QueryActiveThread(INT threadStat[]) 155 | { 156 | vector ACTIVE; 157 | 158 | for (register UINT id = 0; id < maxThreads; ++id) 159 | if (threadStat[id] == thread_ACTIVE) ACTIVE.push_back(id); 160 | 161 | return ACTIVE; 162 | } 163 | 164 | 165 | VOID inline ReserveThreadStat(INT threadStat[], INT threadStatOld[]) 166 | { 167 | for (register UINT id = 0; id < maxThreads; ++id) 168 | threadStatOld[id] = threadStat[id]; 169 | } 170 | 171 | 172 | BOOL inline QueryThreadChange(INT threadStat[], INT threadStatOld[]) 173 | { 174 | BOOL isChanged = FALSE; 175 | 176 | for (register UINT id = 0; id < maxThreads; ++id) 177 | if (threadStat[id] != threadStatOld[id]) isChanged = TRUE; 178 | 179 | return isChanged; 180 | } 181 | 182 | 183 | CString inline QueryWinUserName(VOID) 184 | { 185 | DWORD dwCnt = 0; 186 | LPTSTR pStr = NULL; 187 | 188 | WTSQuerySessionInformation( 189 | WTS_CURRENT_SERVER_HANDLE, 190 | WTS_CURRENT_SESSION, 191 | WTSUserName, 192 | &pStr, 193 | &dwCnt); 194 | 195 | CString winUserName = pStr; 196 | WTSFreeMemory(pStr); 197 | 198 | return winUserName; 199 | } 200 | 201 | 202 | string inline LocalTime(BOOL bShowMS) 203 | { 204 | SYSTEMTIME systime; 205 | GetLocalTime(&systime); 206 | 207 | stringstream ss; 208 | string time; 209 | 210 | ss << systime.wYear << "." 211 | << systime.wMonth << "." 212 | << systime.wDay; 213 | 214 | #ifdef showDay 215 | string day; 216 | switch (systime.wDayOfWeek){ 217 | case 0: day = "Sun"; break; 218 | case 1: day = "Mon"; break; 219 | case 2: day = "Tue"; break; 220 | case 3: day = "Wed"; break; 221 | case 4: day = "Thur"; break; 222 | case 5: day = "Fri"; break; 223 | case 6: day = "Sat"; break; 224 | } 225 | ss << "." << day; 226 | #endif 227 | 228 | ss << " " << systime.wHour << ":" 229 | << systime.wMinute << ":" 230 | << systime.wSecond; 231 | 232 | if (bShowMS) ss << "(" << systime.wMilliseconds << ")"; 233 | 234 | time = ss.str(); 235 | return time; 236 | } 237 | 238 | 239 | string inline LocalTimeMS(VOID) 240 | { 241 | SYSTEMTIME systime; 242 | GetLocalTime(&systime); 243 | 244 | stringstream ss; 245 | string time; 246 | 247 | ss << systime.wYear 248 | << systime.wMonth 249 | << systime.wDay; 250 | 251 | #ifdef showDay 252 | string day; 253 | switch (systime.wDayOfWeek){ 254 | case 0: day = "Sun"; break; 255 | case 1: day = "Mon"; break; 256 | case 2: day = "Tue"; break; 257 | case 3: day = "Wed"; break; 258 | case 4: day = "Thur"; break; 259 | case 5: day = "Fri"; break; 260 | case 6: day = "Sat"; break; 261 | } 262 | ss << "." << day; 263 | #endif 264 | 265 | ss << systime.wHour 266 | << systime.wMinute 267 | << systime.wSecond 268 | << systime.wMilliseconds; 269 | 270 | time = ss.str(); 271 | return time; 272 | } 273 | 274 | 275 | //============================================================================ 276 | // [MFC] threadINFO 277 | //============================================================================ 278 | class threadINFO 279 | { 280 | public : 281 | int job; // Raw(-1) : Create(0) : Destruct(1) : Control(2) 282 | int who; 283 | string name; 284 | 285 | #define tRAW -1 286 | #define tCREATE 0 287 | #define tDESTRUCT 1 288 | #define tCONTROL 2 289 | 290 | threadINFO() 291 | { 292 | this->job = tRAW; 293 | this->who = tRAW; 294 | this->name = ""; 295 | } 296 | 297 | VOID Clear(VOID){ 298 | this->job = tRAW; 299 | this->who = tRAW; 300 | this->name = ""; 301 | } 302 | 303 | template 304 | VOID Create(_T who, string& name){ 305 | this->job = tCREATE; 306 | this->who = who; 307 | this->name = name; 308 | } 309 | 310 | template 311 | VOID Destruct(_T who, string& name){ 312 | this->job = tDESTRUCT; 313 | this->who = who; 314 | this->name = name; 315 | } 316 | 317 | template 318 | VOID Control(_T who, string& name){ 319 | this->job = tCONTROL; 320 | this->who = who; 321 | this->name = name; 322 | } 323 | }; 324 | 325 | 326 | //============================================================================ 327 | // [MFC] keyINFO 328 | //============================================================================ 329 | class keyINFO 330 | { 331 | public : 332 | string keyMsg; 333 | int keyClass; 334 | }; 335 | 336 | 337 | //============================================================================ 338 | // [OpenCV - MFC] cvGENERIC 339 | //============================================================================ 340 | class cvGENERIC 341 | { 342 | public : 343 | //======================================================================== 344 | // Variables 345 | //======================================================================== 346 | vector wnd; 347 | vector img; 348 | Size vidSize; 349 | //------------------------------------------------------------------------ 350 | string Vpath; // [ D:\\root\\title.avi ] 351 | string Vroot; // [ D:\\root\\ ] 352 | string VsubRoot; // [ D:\\root\\title\\ ] Created Sub-root 353 | string Vtitle; // [ title ] without extension 354 | //------------------------------------------------------------------------ 355 | Mat surTitleBox; 356 | BOOL bCreateDir; 357 | //------------------------------------------------------------------------ 358 | INT status; 359 | #define eEXIT 0 360 | #define eRUN 1 361 | //------------------------------------------------------------------------ 362 | #define kNA -1 363 | #define kNUM 0 364 | #define kFUNC 1 365 | //------------------------------------------------------------------------ 366 | private: 367 | INT threadsNUM; 368 | string threads[maxThreads]; 369 | 370 | 371 | //======================================================================== 372 | // Functions 373 | //======================================================================== 374 | public: 375 | cvGENERIC(); ~cvGENERIC(); 376 | 377 | Ptr Config_GFTT(VOID); 378 | Ptr Config_FAST(VOID); 379 | 380 | static Scalar PickBrush(UINT& mThreadID); 381 | static VOID OnMouse(int event, int x, int y, int flags, VOID *param); 382 | Rect2f GetRect(string& winName, Mat& frm, UINT& threadID); 383 | 384 | string CreateWND(VOID); 385 | VOID CreateWND(UINT wnd_num); 386 | VOID PutSurTitle(Mat &panel, string surTitle); 387 | 388 | BOOL LoadImg(Mat &outImg); 389 | UINT LoadImgs(VOID); 390 | string LoadVid(BOOL CreatDir); 391 | 392 | BOOL SaveFrms(Mat& frm, UINT& frmCnt); 393 | BOOL SaveJPG(Mat& img); 394 | BOOL SavePNG(Mat& img); 395 | 396 | keyINFO ReadKey(UINT delay); 397 | 398 | threadINFO WarpThreadPool(string& threadName); 399 | threadINFO ControlThread(string& threadNum); 400 | }; 401 | 402 | 403 | //============================================================================ 404 | // Constructor & Destructor 405 | //============================================================================ 406 | inline cvGENERIC::cvGENERIC() 407 | { 408 | this->status = eRUN; 409 | this->threadsNUM = 0; 410 | 411 | for (register UINT it = 0; it < maxThreads; ++it) 412 | this->threads[it] = ""; 413 | } 414 | 415 | inline cvGENERIC::~cvGENERIC(){} 416 | 417 | 418 | //============================================================================ 419 | // [OpenCV] Config_DETECTOR 420 | //============================================================================ 421 | Ptr inline cvGENERIC::Config_GFTT(VOID) 422 | { 423 | UINT maxCorners = 700; 424 | DOUBLE qualityLevel = 0.001; 425 | DOUBLE minDistance = 15.0; 426 | UINT blockSize = 3; 427 | BOOL useHarrisDetector = FALSE; 428 | DOUBLE k = 0.04; 429 | 430 | return cv::GFTTDetector::create( 431 | maxCorners, // int maxCorners 432 | qualityLevel, // double qualityLevel 433 | minDistance, // double minDistance 434 | blockSize, // int blockSize 435 | useHarrisDetector, // bool useHarrisDetector 436 | k // double k 437 | ); 438 | } 439 | 440 | Ptr inline cvGENERIC::Config_FAST(VOID) 441 | { 442 | UINT threshold = 20; 443 | BOOL nonmaxSuppression = TRUE; 444 | UINT type = FastFeatureDetector::TYPE_9_16; 445 | 446 | return FastFeatureDetector::create( 447 | threshold, // int threshold 448 | nonmaxSuppression, // bool nonmaxSuppression 449 | type // int type 450 | ); 451 | } 452 | 453 | 454 | Scalar inline cvGENERIC::PickBrush(UINT& mThreadID) 455 | { 456 | Scalar BRUSH; 457 | 458 | if (mThreadID == 0) BRUSH = cvBGR_Tomato; 459 | else if (mThreadID == 1) BRUSH = cvBGR_PaleGreen; 460 | else if (mThreadID == 2) BRUSH = cvBGR_DeepSkyBlue; 461 | else if (mThreadID == 3) BRUSH = cvBGR_Violet; 462 | else if (mThreadID == 4) BRUSH = cvBGR_Orange; 463 | else if (mThreadID == 5) BRUSH = cvBGR_LemonChiffon; 464 | else if (mThreadID == 6) BRUSH = cvBGR_Cyan; 465 | else if (mThreadID == 7) BRUSH = cvBGR_Pink; 466 | 467 | return BRUSH; 468 | } 469 | 470 | 471 | //---------------------------------------------------------------------------- 472 | // Variables for cvGENERIC::OnMouse 473 | //---------------------------------------------------------------------------- 474 | static string frameToShow; 475 | static Mat frmPreserve, frmToShow; 476 | static Point2f mPoint; 477 | static Rect2f mRect; 478 | static BOOL mDrag; 479 | static UINT mThreadID; 480 | static BOOL bInitROI; 481 | 482 | 483 | //============================================================================ 484 | // [OpenCV] onMouse 485 | //---------------------------------------------------------------------------- 486 | // MouseCallback function 487 | // Designed for getRect with "Mouse-dragging" 488 | //============================================================================ 489 | VOID inline cvGENERIC::OnMouse(int event, int x, int y, int flags, VOID *param) 490 | { 491 | Scalar BRUSH = PickBrush(mThreadID); 492 | 493 | if (event == CV_EVENT_LBUTTONDOWN && !mDrag) 494 | { 495 | mPoint = Point2f(x, y); 496 | mDrag = TRUE; 497 | } 498 | 499 | if (event == CV_EVENT_MOUSEMOVE && mDrag) 500 | { 501 | frmPreserve.copyTo(frmToShow); 502 | rectangle(frmToShow, mPoint, Point2f(x, y), BRUSH, 2); 503 | imshow(frameToShow, frmToShow); 504 | } 505 | 506 | if (event == CV_EVENT_LBUTTONUP && mDrag) 507 | { 508 | mRect = Rect2f(mPoint, Point2f(x, y)); 509 | 510 | //---------------------------------------------------- 511 | // Coordinate calibration on Inverse-oriented dragging 512 | //---------------------------------------------------- 513 | if (mRect.width < 0){ 514 | mRect.x += mRect.width; 515 | mRect.width = abs(mRect.width); 516 | } 517 | if (mRect.height < 0){ 518 | mRect.y += mRect.height; 519 | mRect.height = abs(mRect.height); 520 | } 521 | 522 | mDrag = FALSE; 523 | bInitROI = TRUE; 524 | } 525 | } 526 | 527 | 528 | //============================================================================ 529 | // [onMouse] getRect 530 | //============================================================================ 531 | Rect2f inline cvGENERIC::GetRect(string& winName, Mat& frm, UINT& threadID) 532 | { 533 | mThreadID = threadID; 534 | 535 | bInitROI = FALSE; 536 | mDrag = FALSE; 537 | frameToShow = winName; 538 | mRect = Rect2f(-1, -1, -1, -1); 539 | 540 | frm.copyTo(frmPreserve); 541 | 542 | setMouseCallback(winName, OnMouse, NULL); 543 | while (!bInitROI) waitKey(keyDelay); 544 | setMouseCallback(winName, NULL, NULL); 545 | 546 | return mRect; 547 | } 548 | 549 | 550 | //======================================================================== 551 | // Multiple cv::NamedWindow Creator /w prefix "wnd_" 552 | //======================================================================== 553 | string inline cvGENERIC::CreateWND() 554 | { 555 | this->wnd.clear(); 556 | this->wnd.push_back("Display"); namedWindow(wnd[0]); 557 | return this->wnd[0]; 558 | } 559 | 560 | VOID inline cvGENERIC::CreateWND(UINT wnd_num) 561 | { 562 | this->wnd.clear(); 563 | 564 | for (UINT it = 0; it < wnd_num; ++it){ 565 | stringstream ss; 566 | ss << "wnd_" << std::setfill('0') << std::setw(2) << it; 567 | this->wnd.push_back(ss.str()); namedWindow(wnd[it]); 568 | } 569 | } 570 | 571 | 572 | //======================================================================== 573 | // [OpenCV] Put SurTitle 574 | //======================================================================== 575 | VOID inline cvGENERIC::PutSurTitle(Mat &panel, string surTitle) 576 | { 577 | this->surTitleBox = panel(cv::Rect(0, 0, panel.cols, 30)); 578 | this->surTitleBox.setTo(cvBGR_Black); 579 | 580 | putText(surTitleBox, surTitle, 581 | Point(5, 20), FONT_HERSHEY_SIMPLEX, 0.6, 582 | cvBGR_Yellow 583 | ); 584 | } 585 | 586 | 587 | //======================================================================== 588 | // [MFC] Single Image File Loader 589 | //======================================================================== 590 | BOOL inline cvGENERIC::LoadImg(Mat &outImg) 591 | { 592 | //----------------------------------------------------------- 593 | // [Set CFileDialog Options] 594 | //----------------------------------------------------------- 595 | static TCHAR BASED_CODE szFilter[] = 596 | _T("image | *.bmp; *.jpg; *.png; |") 597 | _T("jpg | *.jpg; |") 598 | _T("png | *.png; ||"); 599 | 600 | CFileDialog FileDlg(TRUE, 0, 0, 601 | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, 602 | szFilter 603 | ); 604 | 605 | if (FileDlg.DoModal() == IDOK) 606 | { 607 | CT2CA Apath(FileDlg.GetPathName()); 608 | outImg = imread(Apath.operator LPSTR()); 609 | 610 | CT2CA Aroot(FileDlg.GetFolderPath()); 611 | this->Vroot = Aroot.operator LPSTR(); 612 | 613 | stringstream ss; 614 | ss << Vroot << "\\"; 615 | this->Vroot = ss.str(); 616 | 617 | CT2CA Atitle(FileDlg.GetFileTitle()); 618 | this->Vtitle = Atitle.operator LPSTR(); 619 | } 620 | 621 | return !(outImg.empty()); 622 | } 623 | 624 | 625 | //======================================================================== 626 | // [MFC] Multiple Image Files Loader 627 | //======================================================================== 628 | UINT inline cvGENERIC::LoadImgs() 629 | { 630 | vector imgPath; 631 | this->img.clear(); 632 | 633 | #define MAX_FILES 10000 634 | #define BUFFER_SIZE ((MAX_FILES * (MAX_PATH + 1)) + 1) 635 | 636 | //----------------------------------------------------------- 637 | // [Memory Allocation] wchar_t* = CString 638 | //----------------------------------------------------------- 639 | CString CSTRING; 640 | wchar_t* Linear = CSTRING.GetBuffer(BUFFER_SIZE); 641 | CSTRING.ReleaseBuffer(); 642 | 643 | //----------------------------------------------------------- 644 | // [Set CFileDialog Options] 645 | //----------------------------------------------------------- 646 | static TCHAR BASED_CODE szFilter[] = 647 | _T("image | *.bmp; *.jpg; *.png; |") 648 | _T("jpg | *.jpg; |") 649 | _T("png | *.png; ||"); 650 | 651 | CFileDialog FileDlg(TRUE, 0, 0, 652 | OFN_ALLOWMULTISELECT, 653 | szFilter 654 | ); 655 | 656 | OPENFILENAME& OFN = FileDlg.GetOFN(); 657 | OFN.nMaxFile = BUFFER_SIZE; 658 | OFN.lpstrFile = Linear; 659 | 660 | //----------------------------------------------------------- 661 | // [File Segmentation] 662 | //----------------------------------------------------------- 663 | if (FileDlg.DoModal() == IDOK) 664 | { 665 | CString ROOT; CString fileName; 666 | 667 | wchar_t* EOL = Linear + BUFFER_SIZE - 2; 668 | wchar_t* ENTRY = Linear; 669 | 670 | while ((Linear < EOL) && (*Linear)) Linear++; 671 | 672 | if (Linear > ENTRY) 673 | { // [ROOT Stage] 674 | ROOT = ENTRY; 675 | Linear++; 676 | 677 | // Case of Loading a Single File ------------ 678 | if (!(*Linear)){ 679 | CT2CA CONV(ROOT); 680 | imgPath.push_back(CONV.operator LPSTR()); 681 | } 682 | // ------------------------------------------ 683 | 684 | while ((Linear < EOL) && (*Linear)) 685 | { 686 | ENTRY = Linear; 687 | while ((Linear < EOL) && (*Linear)) Linear++; 688 | 689 | if (Linear > ENTRY) 690 | { // [fileName Stage] 691 | fileName = ROOT; fileName += "\\"; fileName += ENTRY; 692 | CT2CA CONV(fileName); 693 | imgPath.push_back(CONV.operator LPSTR()); 694 | Linear++; 695 | } 696 | } 697 | } 698 | #undef MAX_FILES 699 | #undef BUFFER_SIZE 700 | } // From here use vector imgPath 701 | 702 | for (UINT it = 0; it < imgPath.size(); ++it) 703 | this->img.push_back(imread(imgPath[it])); 704 | 705 | return this->img.size(); 706 | } 707 | 708 | 709 | //======================================================================== 710 | // [MFC] Single Video File Loader 711 | //======================================================================== 712 | string inline cvGENERIC::LoadVid(BOOL CreatDir) 713 | { 714 | LPCTSTR szFilter = L"video | *.mp4; *.avi; ||"; 715 | CFileDialog FileDlg(1, 0, 0, 0, szFilter); 716 | 717 | if (FileDlg.DoModal() == IDOK) 718 | { 719 | CT2CA Atitle(FileDlg.GetFileTitle()); 720 | this->Vtitle = Atitle.operator LPSTR(); 721 | 722 | CT2CA Apath(FileDlg.GetPathName()); 723 | this->Vpath = Apath.operator LPSTR(); 724 | 725 | CT2CA Aroot(FileDlg.GetFolderPath()); 726 | this->Vroot = Aroot.operator LPSTR(); 727 | 728 | stringstream ss; 729 | ss << Vroot << "\\"; 730 | this->Vroot = ss.str(); 731 | 732 | ss << Vtitle << "\\"; 733 | this->VsubRoot = ss.str(); 734 | 735 | if (CreatDir == TRUE){ 736 | this->bCreateDir = TRUE; 737 | CA2CT Troot(VsubRoot.c_str()); 738 | ::CreateDirectory(Troot, 0); 739 | } 740 | else { 741 | this->bCreateDir = FALSE; 742 | } 743 | } 744 | 745 | VideoCapture vid(Vpath); 746 | if (vid.isOpened()) 747 | { 748 | Mat frm; 749 | vid >> frm; 750 | 751 | this->vidSize = Size(vid.get(3), vid.get(4)); 752 | // 3 : CAP_PROP_FRAME_WIDTH 753 | // 4 : CAP_PROP_FRAME_HEIGHT 754 | } 755 | 756 | vid.release(); 757 | 758 | return Vpath; 759 | } 760 | 761 | 762 | //======================================================================== 763 | // [OpenCV] Save a Video frame with [ frmCnt ] as postfix 764 | //------------------------------------------------------------------------ 765 | // Save into the Video's subFolder >> D:\\root\\title\\title_000000.jpg 766 | // If the subFolder was not created, returns FALSE. Else returns imwrite() 767 | //======================================================================== 768 | BOOL inline cvGENERIC::SaveFrms(Mat& frm, UINT& frmCnt) 769 | { 770 | if (!this->bCreateDir) return FALSE; 771 | 772 | stringstream ss; 773 | ss << this->VsubRoot << this->Vtitle << "_" << setfill('0') << setw(6) 774 | << frmCnt << ".jpg"; 775 | 776 | return imwrite(ss.str(), frm); 777 | } 778 | 779 | 780 | //======================================================================== 781 | // [OpenCV] Write a given Image 782 | //------------------------------------------------------------------------ 783 | // Write into the same root located by LoadImg() or by LoadVid() 784 | //======================================================================== 785 | BOOL inline cvGENERIC::SaveJPG(Mat& img) 786 | { 787 | if (this->Vroot.empty() || this->Vtitle.empty()) return false; 788 | 789 | stringstream ss; 790 | ss << Vroot << Vtitle << "_new.jpg"; 791 | 792 | return imwrite(ss.str(), img); 793 | } 794 | 795 | BOOL inline cvGENERIC::SavePNG(Mat& img) 796 | { 797 | if (this->Vroot.empty() || this->Vtitle.empty()) return false; 798 | 799 | vector pngPOLICY; 800 | pngPOLICY.push_back(CV_IMWRITE_PNG_COMPRESSION); 801 | pngPOLICY.push_back(0); 802 | 803 | stringstream ss; 804 | ss << Vroot << Vtitle << "_new.png"; 805 | 806 | return imwrite(ss.str(), img, pngPOLICY); 807 | } 808 | 809 | 810 | //======================================================================== 811 | // [OpenCV] Keyboard Message Handler 812 | //======================================================================== 813 | keyINFO inline cvGENERIC::ReadKey(UINT delay) 814 | { 815 | UINT key = waitKey(delay); 816 | keyINFO kINFO; 817 | 818 | if (key == 81 || key == 113) { kINFO.keyMsg = "[Q]"; kINFO.keyClass = kNA; } 819 | else if (key == 82 || key == 114) { kINFO.keyMsg = "[R]"; kINFO.keyClass = kNA; } 820 | else if (key == 67 || key == 99) { kINFO.keyMsg = "[C]"; kINFO.keyClass = kNA; } 821 | else if (key == 13) { kINFO.keyMsg = "[ENTER]"; kINFO.keyClass = kNA; } 822 | else if (key == 32) { kINFO.keyMsg = "[SPACE]"; kINFO.keyClass = kNA; } 823 | else if (key == 48) { kINFO.keyMsg = "[0]"; kINFO.keyClass = kNA; } 824 | else if (key == 49) { kINFO.keyMsg = "[1]"; kINFO.keyClass = kNUM; } 825 | else if (key == 50) { kINFO.keyMsg = "[2]"; kINFO.keyClass = kNUM; } 826 | else if (key == 51) { kINFO.keyMsg = "[3]"; kINFO.keyClass = kNUM; } 827 | else if (key == 52) { kINFO.keyMsg = "[4]"; kINFO.keyClass = kNUM; } 828 | else if (key == 53) { kINFO.keyMsg = "[5]"; kINFO.keyClass = kNUM; } 829 | else if (key == 54) { kINFO.keyMsg = "[6]"; kINFO.keyClass = kNUM; } 830 | else if (key == 55) { kINFO.keyMsg = "[7]"; kINFO.keyClass = kNUM; } 831 | else if (key == 56) { kINFO.keyMsg = "[8]"; kINFO.keyClass = kNUM; } 832 | else if (key == 57) { kINFO.keyMsg = "[9]"; kINFO.keyClass = kNA; } 833 | else if (key >= 0 && key < 128) { kINFO.keyMsg = (char)key; kINFO.keyClass = kNA; } 834 | else if (key == 7340032) { kINFO.keyMsg = "[F1]"; kINFO.keyClass = kFUNC; } 835 | else if (key == 7405568) { kINFO.keyMsg = "[F2]"; kINFO.keyClass = kFUNC; } 836 | else if (key == 7471104) { kINFO.keyMsg = "[F3]"; kINFO.keyClass = kFUNC; } 837 | else if (key == 7536640) { kINFO.keyMsg = "[F4]"; kINFO.keyClass = kFUNC; } 838 | else if (key == 7602176) { kINFO.keyMsg = "[F5]"; kINFO.keyClass = kFUNC; } 839 | else if (key == 7667712) { kINFO.keyMsg = "[F6]"; kINFO.keyClass = kFUNC; } 840 | else if (key == 7733248) { kINFO.keyMsg = "[F7]"; kINFO.keyClass = kFUNC; } 841 | else if (key == 7798784) { kINFO.keyMsg = "[F8]"; kINFO.keyClass = kFUNC; } 842 | else if (key == 7864320) { kINFO.keyMsg = "[F9]"; kINFO.keyClass = kNA; } 843 | else if (key == 7929856) { kINFO.keyMsg = "[F10]"; kINFO.keyClass = kNA; } 844 | else if (key == 7995392) { kINFO.keyMsg = "[F11]"; kINFO.keyClass = kNA; } 845 | else if (key == 8060928) { kINFO.keyMsg = "[F12]"; kINFO.keyClass = kNA; } 846 | else if (key == 2424832) { kINFO.keyMsg = "[<]"; kINFO.keyClass = kNA; } 847 | else if (key == 2555904) { kINFO.keyMsg = "[>]"; kINFO.keyClass = kNA; } 848 | else if (key == 2490368) { kINFO.keyMsg = "[^]"; kINFO.keyClass = kNA; } 849 | else if (key == 2621440) { kINFO.keyMsg = "[v]"; kINFO.keyClass = kNA; } 850 | else { kINFO.keyMsg = ""; kINFO.keyClass = kNA; } 851 | 852 | return kINFO; 853 | } 854 | 855 | 856 | //======================================================================== 857 | // Parse { construction / destruct } of threads 858 | //======================================================================== 859 | threadINFO inline cvGENERIC::WarpThreadPool(string& threadName) 860 | { 861 | //--------------------------- 862 | // Temporal Method 863 | // [Fn] -> [n] -> n 864 | //--------------------------- 865 | threadName.erase(1, 1); 866 | char numPart = threadName[1]; 867 | UINT num = atoi(&numPart); 868 | UINT nth = num - 1; 869 | 870 | threadINFO tINFO; 871 | 872 | //---------------------------------------- 873 | // threads isn't empty 874 | //---------------------------------------- 875 | if (this->threadsNUM > 0) 876 | { 877 | if (this->threads[nth] != "") 878 | { // delete the existing 879 | 880 | this->threads[nth] = ""; 881 | this->threadsNUM--; 882 | tINFO.Destruct(nth, threadName); 883 | } 884 | else 885 | { // insert the new 886 | 887 | this->threads[nth] = threadName; 888 | this->threadsNUM++; 889 | tINFO.Create(nth, threadName); 890 | } 891 | 892 | } 893 | 894 | //---------------------------------------- 895 | // threads is empty 896 | //---------------------------------------- 897 | else 898 | { // insert the new 899 | 900 | this->threads[nth] = threadName; 901 | this->threadsNUM++; 902 | tINFO.Create(nth, threadName); 903 | } 904 | 905 | return tINFO; 906 | } 907 | 908 | 909 | //======================================================================== 910 | // Parse { control } of threads 911 | //======================================================================== 912 | threadINFO inline cvGENERIC::ControlThread(string& threadNum) 913 | { 914 | //------------------------- 915 | // Temporal Method 916 | // [Fn] -> [n] -> n 917 | //------------------------- 918 | char numPart = threadNum[1]; 919 | UINT num = atoi(&numPart); 920 | UINT nth = num - 1; 921 | 922 | threadINFO tINFO; 923 | 924 | if (nth < 0) 925 | { // pressed [0] 926 | 927 | tINFO.Clear(); 928 | return tINFO; 929 | } 930 | 931 | //------------------------------------------------------- 932 | // threads isn't empty 933 | //------------------------------------------------------- 934 | if (this->threadsNUM > 0) 935 | { 936 | if(this->threads[nth] != "") 937 | { // control the match 938 | 939 | tINFO.Control(nth, threadNum); 940 | } 941 | 942 | else 943 | { // nothing matched 944 | 945 | tINFO.Clear(); 946 | } 947 | } 948 | 949 | //------------------------------------------------------- 950 | // threads is empty 951 | //------------------------------------------------------- 952 | else 953 | { 954 | tINFO.Clear(); 955 | } 956 | 957 | return tINFO; 958 | } -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/fastcluster.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/fastcluster.h -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/fusion.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "fusion.h" 3 | 4 | 5 | namespace cmt { 6 | 7 | BOOL Fusion::preferFirst( 8 | const vector& pointsFirst, 9 | const vector& classesFirst, 10 | const vector& pointsSecond, 11 | const vector& classesSecond, 12 | vector& pointsFused, 13 | vector& classesFused 14 | ){ 15 | 16 | if ( 17 | // (pointsFirst.size() == 0) || 18 | (pointsSecond.size() == 0) || 19 | (pointsSecond.size() != classesSecond.size()) || 20 | (pointsFirst.size() != classesFirst.size()) 21 | ) 22 | { 23 | return FALSE; 24 | } 25 | 26 | pointsFused = pointsFirst; 27 | classesFused = classesFirst; 28 | 29 | for (register UINT id2nd = 0; id2nd < pointsSecond.size(); ++id2nd) 30 | { 31 | register int secondClass = classesSecond[id2nd]; 32 | 33 | bool bOverlap = false; 34 | for (register UINT id1st = 0; id1st < pointsFirst.size(); id1st++) 35 | { 36 | register int firstClass = classesFirst[id1st]; 37 | if (firstClass == secondClass) bOverlap = true; 38 | } 39 | 40 | if (!bOverlap) 41 | { 42 | pointsFused.push_back(pointsSecond[id2nd]); 43 | classesFused.push_back(secondClass); 44 | } 45 | } 46 | 47 | return TRUE; 48 | } 49 | 50 | } // namespace cmt 51 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/fusion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Fusion { 9 | 10 | //----------------------------------------------------------------- 11 | public: 12 | //----------------------------------------------------------------- 13 | 14 | BOOL preferFirst( 15 | const vector& pointsFirst, 16 | const vector& classesFirst, 17 | const vector& pointsSecond, 18 | const vector& classesSecond, 19 | vector& pointsFused, 20 | vector& classesFused 21 | ); 22 | 23 | }; 24 | 25 | } // namespace CMT 26 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/gcPreprocess.hpp: -------------------------------------------------------------------------------- 1 | // Robinus Fuser. 2015-09-25 06:15 2 | // Electronics Dept. Konkuk Univ. South Korea 3 | // fordicus@naver.com 4 | 5 | 6 | #pragma once 7 | 8 | #include // for QueryWinUserName() 9 | #pragma comment(lib, "Wtsapi32.lib") // for QueryWinUserName() 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | using namespace std; 20 | 21 | 22 | //---------------------------------------------------------------------------- 23 | // #define DEBUG_PROGRAM 24 | #define PROFILE_PROGRAM 25 | 26 | #define keyDelay 1 27 | #define drawTimer 100 28 | #define maxThreads 8 29 | #define maxDetectors 2 30 | 31 | #define consoleSweep "\r\n \r\n \r\n \r\n " 32 | #define notify_ONE "Allow single Process." 33 | #define notify_END "the End." 34 | 35 | //---------------------------------------------------------------------------- 36 | #ifndef TRUE 37 | #define TRUE 1 38 | #define FALSE 0 39 | #endif 40 | 41 | #ifndef VOID 42 | #define VOID void 43 | #endif 44 | 45 | typedef unsigned long long ULONGLONG; 46 | typedef int INT; 47 | typedef unsigned int UINT; 48 | typedef unsigned char UCHAR; 49 | //typedef bool BOOL; -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/gcProfile.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/gcProfile.hpp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/matcher.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/matcher.cpp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/matcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Matcher { 9 | 10 | //----------------------------------------------------------------- 11 | public: 12 | //----------------------------------------------------------------- 13 | 14 | Matcher() : thrDist(0.25), thrRatio(0.8), thrCutoff(20) {}; 15 | 16 | void initialize( 17 | const vector& vectorsFG, 18 | const MatND& database, 19 | const vector& classes, 20 | const int& numPointsBG 21 | ); 22 | 23 | BOOL matchGlobal( 24 | const vector& keypoints, 25 | const MatND& descriptors, 26 | vector& pointsMatched, 27 | vector& classesMatched 28 | ); 29 | 30 | BOOL matchLocal( 31 | const vector& keypoints, 32 | const MatND& descriptors, 33 | const float& scale, 34 | const float& rotation, 35 | const Point2f& center, 36 | vector& pointsMatched, 37 | vector& classesMatched 38 | ); 39 | 40 | 41 | //----------------------------------------------------------------- 42 | private: 43 | //----------------------------------------------------------------- 44 | 45 | vector vectorsFG; 46 | MatND database; 47 | vector classes; 48 | int descLength; 49 | int numPointsBG; 50 | Ptr bfmatcher; 51 | float thrDist; 52 | float thrRatio; 53 | float thrCutoff; 54 | 55 | }; 56 | 57 | } // namespace CMT 58 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/BRLNSB.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/BRLNSB.TTF -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/BRLNSDB.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/BRLNSDB.TTF -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/BRLNSR.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/BRLNSR.TTF -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/cmtDlg.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/cmtDlg.ico -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/cmtDlg.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/cmtDlg.rc2 -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet.pptx -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/0.png -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F1_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F1_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F1_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F1_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F2_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F2_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F2_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F2_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F3_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F3_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F3_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F3_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F4_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F4_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F4_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F4_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F5_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F5_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F5_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F5_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F6_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F6_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F6_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F6_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F7_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F7_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F7_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F7_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F8_0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F8_0.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/F8_1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/F8_1.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/Fn_LIST.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/Fn_LIST.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/Fn_x.bmp: -------------------------------------------------------------------------------- 1 | BMN$6(77$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/making.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/making.png -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/making2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/making2.png -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/res/icoSet/pannel.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/res/icoSet/pannel.bmp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/resource.h -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/stdafx.cpp -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/stdafx.h -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/Release v1.2/cmtDlg/targetver.h -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/tracker.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "tracker.h" 3 | 4 | 5 | namespace cmt { 6 | 7 | BOOL Tracker::track( 8 | const Mat& imPrev, 9 | const Mat& imGray, 10 | const vector& pointsPrev, 11 | vector& pointsTracked, 12 | vector& status 13 | ){ 14 | 15 | if (pointsPrev.size() > 0) 16 | { 17 | vector err; 18 | 19 | //------------------------------------------------------------------------------------------ 20 | // Calculate [Forward Optical Flow] 21 | //------------------------------------------------------------------------------------------ 22 | calcOpticalFlowPyrLK(imPrev, imGray, pointsPrev, pointsTracked, status, err); 23 | 24 | //------------------------------------------------------------------------------------------ 25 | // Calculate [Backward Optical Flow] 26 | //------------------------------------------------------------------------------------------ 27 | vector pointsBack; 28 | vector statusBack; 29 | vector errBack; 30 | 31 | calcOpticalFlowPyrLK(imGray, imPrev, pointsTracked, pointsBack, statusBack, errBack); 32 | 33 | 34 | //------------------------------------------------------------------------------------------ 35 | // Remove [Mal-tracked points] 36 | //------------------------------------------------------------------------------------------ 37 | for (register UINT it = pointsPrev.size() - 1; it > 0; --it) 38 | { 39 | float l2norm = norm(pointsBack[it] - pointsPrev[it]); 40 | bool bPointsFly = l2norm > thrPointsFly; 41 | 42 | if (bPointsFly || !status[it] || !statusBack[it]) 43 | { 44 | pointsTracked.erase(pointsTracked.begin() + it); 45 | status[it] = 0; 46 | } 47 | } 48 | 49 | return TRUE; 50 | } 51 | 52 | else 53 | { 54 | return FALSE; 55 | } 56 | } 57 | 58 | } // namespace cmt 59 | -------------------------------------------------------------------------------- /Release v1.2/cmtDlg/tracker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "common.h" 5 | 6 | namespace cmt { 7 | 8 | class Tracker { 9 | //----------------------------------------------------------------- 10 | public: 11 | //----------------------------------------------------------------- 12 | 13 | Tracker() : thrPointsFly(30) {}; 14 | 15 | BOOL track( 16 | const Mat& imPrev, 17 | const Mat& imGray, 18 | const vector& pointsPrev, 19 | vector& pointsTracked, 20 | vector& status 21 | ); 22 | 23 | 24 | //----------------------------------------------------------------- 25 | private: 26 | //----------------------------------------------------------------- 27 | 28 | float thrPointsFly; 29 | 30 | }; 31 | 32 | } // namespace CMT 33 | -------------------------------------------------------------------------------- /WinCMT Tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fordicus/CMT-Threaded-on-Windows/adcff42f3544e22b6b4137e5fdb635b243cb7cb9/WinCMT Tutorial.pdf --------------------------------------------------------------------------------