https://github.com/acai66/opencv_matching

A template matching library based on OpenCV, supporting rotation matching, cross-platform usage, C++, and Python. 基于opencv的模板匹配库,支持旋转匹配,支持跨平台、c++调用、python调用

https://github.com/acai66/opencv_matching

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (4.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

A template matching library based on OpenCV, supporting rotation matching, cross-platform usage, C++, and Python. 基于opencv的模板匹配库,支持旋转匹配,支持跨平台、c++调用、python调用

Basic Info
  • Host: GitHub
  • Owner: acai66
  • License: bsd-2-clause
  • Language: C++
  • Default Branch: main
  • Homepage:
  • Size: 4.36 MB
Statistics
  • Stars: 40
  • Watchers: 1
  • Forks: 8
  • Open Issues: 4
  • Releases: 1
Created about 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.md

模板匹配

demo1

demo2

改进

  1. 封装为更易用的库
  2. 跨平台适配

计划

  • [ ] 优化代码结构
  • [x] 支持python

编译

clone代码

git克隆时同步克隆子模块

shell git clone --recurse-submodules https://github.com/acai66/opencv_matching.git

编译代码

Windows

使用各种编译cmake的方法(vs2022、vs2019、vs2017、或cmake-gui)编译即可,演示使用vs2022编译,其余工具供参考。

编译演示视频:B站链接

Linux

演示Ubuntu 22.04下编译,其他发行版类似

  1. 安装依赖和编译工具

shell sudo apt-get update sudo apt-get install libopencv-dev build-essential cmake

  1. 终端进入到项目根目录,创建build文件夹

shell cd opencv_matching mkdir build cd build

  1. cmake构建

shell cmake -DCMAKE_INSTALL_PREFIX=./install ..

  1. make编译

shell make

  1. 安装

shell make install

成功后会在 build 目录下生成 install 文件夹,里面包含编译好的库(lib)和头文件(include), 以及 demo 可执行文件(bin).

目录结构如下:

shell install ├── bin │   └── demo ├── include │   ├── matcher.h │   └── templatematching.h └── lib ├── libtemplatematching.so └── libtemplatematching_ctype.so

install/bin 下运行 demo 时,需要确保 libtemplatematching.so 在运行目录下,或者将 libtemplatematching.so 放到系统库目录下。

shell cd install/bin/ cp ../lib/libtemplatematching.so ./ ./demo

注意事项

  • 作者机器上不同项目使用的opencv版本不同,所以没有把opencv添加到系统环境变量中,opencv放进了3rdParty文件夹下,目录结构参考如下:

windows_opencv_path

  • 如需修改opencv路径,可能需要修改如下信息,具体参考 CMakeLists.txtmatcher/CMakeLists.txt 文件:

CMakeLists.txt

cmake if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") set(OpenCV_DIR ${PROJECT_SOURCE_DIR}/3rdParty/opencv) endif()

matcher/CMakeLists.txt

cmake if(WIN32) install(FILES ${PROJECT_SOURCE_DIR}/3rdParty/opencv/x64/vc16/bin/opencv_world490.dll TYPE BIN DESTINATION ${CMAKE_INSTALL_BINDIR}) else()

使用

将编译的库集成到其他项目中

编译完成后,可以在安装目录下找到 templatematching.dlltemplatematching_ctype.dll

C++

c++编译时只需要引入头文件即可,dll是在运行时加载的,只需要 templatematching.dll,详细调用参考 demo.cpp

python

python使用时需要将 templatematching.dlltemplatematching_ctype.dll 放进运行目录,演示代码参考 py_demo.py

Owner

  • Name: acai
  • Login: acai66
  • Kind: user

悟已往之不谏,知来者之可追

GitHub Events

Total
  • Issues event: 4
  • Watch event: 23
  • Issue comment event: 11
  • Fork event: 5
Last Year
  • Issues event: 4
  • Watch event: 23
  • Issue comment event: 11
  • Fork event: 5

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 10
  • Total pull requests: 0
  • Average time to close issues: 3 days
  • Average time to close pull requests: N/A
  • Total issue authors: 8
  • Total pull request authors: 0
  • Average comments per issue: 3.1
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 0
  • Average time to close issues: 3 days
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 3.67
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • lwzhaojun (2)
  • dingzhenzhenzhu258 (2)
  • liulang100 (1)
  • mandoo2 (1)
  • jingmeng73 (1)
  • hedie-rgb (1)
  • gunh4mmer (1)
  • Syorst (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels