└── edge template match ├── Main.cpp ├── Search1.jpg ├── Search2.jpg ├── GeoMatch.cpp ├── Template.jpg ├── CommandParser.h ├── CommandParser.cpp └── GeoMatch.h /edge template match/Main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxiaHuang/edge-template-match/HEAD/edge template match/Main.cpp -------------------------------------------------------------------------------- /edge template match/Search1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxiaHuang/edge-template-match/HEAD/edge template match/Search1.jpg -------------------------------------------------------------------------------- /edge template match/Search2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxiaHuang/edge-template-match/HEAD/edge template match/Search2.jpg -------------------------------------------------------------------------------- /edge template match/GeoMatch.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxiaHuang/edge-template-match/HEAD/edge template match/GeoMatch.cpp -------------------------------------------------------------------------------- /edge template match/Template.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daxiaHuang/edge-template-match/HEAD/edge template match/Template.jpg -------------------------------------------------------------------------------- /edge template match/CommandParser.h: -------------------------------------------------------------------------------- 1 | //*********************************************************************** 2 | // Project : GeoMatch 3 | // Author : Shiju P K 4 | // Email : shijupk@gmail.com 5 | // Created : 03-07-2010 6 | // 7 | // File Name : CommandParser.h 8 | // Last Modified By : Shiju P K 9 | // Last Modified On : 03-07-2010 10 | // Description : class to implement comand line parsing 11 | // 12 | // Copyright : (c) . All rights reserved. 13 | //*********************************************************************** 14 | #pragma once 15 | 16 | class CommandParser 17 | { 18 | char **argList; //point to hold argument list 19 | int numArgs; // no of arguments in the list 20 | public: 21 | CommandParser(void); 22 | CommandParser(int,char**); 23 | ~CommandParser(void); 24 | char* GetParameter(const char *key); 25 | }; 26 | -------------------------------------------------------------------------------- /edge template match/CommandParser.cpp: -------------------------------------------------------------------------------- 1 | //*********************************************************************** 2 | // Project : GeoMatch 3 | // Author : Shiju P K 4 | // Email : shijupk@gmail.com 5 | // Created : 03-07-2010 6 | // 7 | // File Name : CommandParser.cpp 8 | // Last Modified By : Shiju P K 9 | // Last Modified On : 03-07-2010 10 | // Description : class to implement comand line parsing 11 | // 12 | // Copyright : (c) . All rights reserved. 13 | //*********************************************************************** 14 | #include "StdAfx.h" 15 | #include "string.h" 16 | #include "CommandParser.h" 17 | 18 | // default constucter 19 | CommandParser::CommandParser(void) 20 | { 21 | numArgs = 0; 22 | argList = NULL; 23 | } 24 | 25 | CommandParser::~CommandParser(void) 26 | { 27 | } 28 | //constructer to initialize with number of argument and argument list 29 | CommandParser::CommandParser(int _numArgs,char** _argList) 30 | { 31 | numArgs = _numArgs; 32 | argList = _argList; 33 | } 34 | 35 | //return argument that curresponds to the key 36 | char* CommandParser::GetParameter(const char *key) 37 | { 38 | for( int currArg = 0; currArg < numArgs; currArg++ ) 39 | { 40 | if( strcmp( key, argList[currArg] ) == 0 ) 41 | return argList[currArg+1]; 42 | } 43 | 44 | return NULL; 45 | } -------------------------------------------------------------------------------- /edge template match/GeoMatch.h: -------------------------------------------------------------------------------- 1 | //*********************************************************************** 2 | // Project : GeoMatch 3 | // Author : Shiju P K 4 | // Email : shijupk@gmail.com 5 | // Created : 10-01-2010 6 | // 7 | // File Name : GeoMatch.h 8 | // Last Modified By : Shiju P K 9 | // Last Modified On : 13-07-2010 10 | // Description : class to implement edge based template matching 11 | // 12 | // Copyright : (c) . All rights reserved. 13 | //*********************************************************************** 14 | 15 | #pragma once 16 | #include 17 | #include 18 | 19 | class GeoMatch 20 | { 21 | private: 22 | int m_noOfCordinates; //Number of elements in coordinate array 23 | cv::Point *m_cordinates; //Coordinates array to store model points 24 | int m_modelHeight; //Template height 25 | int m_modelWidth; //Template width 26 | double *m_edgeMagnitude; //gradient magnitude 27 | double *m_edgeDerivativeX; //gradient in X direction 28 | double *m_edgeDerivativeY; //radient in Y direction 29 | cv::Point m_centerOfGravity; //Center of gravity of template 30 | 31 | bool m_modelDefined; 32 | 33 | void CreateDoubleMatrix(double **&matrix,CvSize size); 34 | void ReleaseDoubleMatrix(double **&matrix,int size); 35 | public: 36 | GeoMatch(void); 37 | GeoMatch(const void* templateArr); 38 | ~GeoMatch(void); 39 | 40 | int CreateGeoMatchModel(cv::Mat& src, double, double); 41 | void GeoMatch::DrawContours(cv::Mat& source, cv::Point COG, int color); 42 | void DrawContours(cv::Mat& source, int color); 43 | void FindGeoMatchModel(cv::Mat& src, cv::Mat& dst, double minScore, double greediness); 44 | 45 | }; 46 | --------------------------------------------------------------------------------