Giter VIP home page Giter VIP logo

multitemplatematching-python's People

Contributors

bart-leboeuf avatar dependabot[bot] avatar imagejan avatar laulauthom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

multitemplatematching-python's Issues

Problem with images

I am trying to use this for detecting cracks on metal surfaces. I am getting this error (copied in the end). I have attached the code and images to reproduce this error. Can you please help out?

Error:


Traceback (most recent call last):
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/tutorials/SampleError.py", line 41, in
Hits = matchTemplates(listTemplate, im1, score_threshold=0.9, method=5, maxOverlap=0)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 271, in matchTemplates
tableHit = findMatches(listTemplates, image, method, N_object, score_threshold, searchBox)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 149, in findMatches
_ = future.result()
File "/Users/pallavidubey/mambaforge/envs/mtm/lib/python3.9/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/Users/pallavidubey/mambaforge/envs/mtm/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
File "/Users/pallavidubey/mambaforge/envs/mtm/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 201, in _multi_compute
corrMap = computeScoreMap(template, image, method, mask=mask)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 87, in computeScoreMap
return cv2.matchTemplate(image, template, method, mask=mask)
cv2.error: OpenCV(4.7.0) /Users/xperience/GHA-OCV-Python/_work/opencv-python/opencv-python/opencv/modules/imgproc/src/templmatch.cpp:588: error: (-215:Assertion failed) corr.rows <= img.rows + templ.rows - 1 && corr.cols <= img.cols + templ.cols - 1 in function 'crossCorr'
SampleError.zip

Possible outside Jupyter?

Hi. Is it possible to use MTM outside of Jupyter? For example, in Visual Studio Code, using Anaconda/Python3.7 (and not a Jupyter notebook)?

Getting findMatches to work when a template doesn't fit the searchBox

To speed up the matchTemplates function I decided to first run some image preprocessing and extract rectangles representing my regions of interest. With some templates being smaller than others I often get rectangles that only fit the smaller templates. When a template bigger than the currrent searchbox is tried, the error

  • cv2.error: (-215:Assertion failed) _img.size().height <= _templ.size().height && ;_img.size().width <= _templ.size().width in function 'cv::matchTemplate'

occurs on

  • init line 143 corrMap = computeScoreMap(template, image, method, mask=mask)

I bandaided the issue by wrapping that line in a try except block, but some logic to check sizes earlier in the function would probably save time.

License

Hi @LauLauThom

Really useful.
Would it be possible to change this to a more permissive license such as MIT ?
With GPL it is difficult to bundle this with other applications.

The required opencv-python-headless version could not be found

When I try to use pip install it gives me this error because it can't find this version of opencv-python-headless. I tried using pip install to install the latest opencv-python-headless, which is 4.2.0.34, but when I tried to install your package it still tried to grab the older version dependency and returned that error.
I've made sure that I uninstalled previous opencv-python versions before doing this too.

(venv) C:\Users\Stuart\PycharmProjects\bot_tutorial1>pip install Multi-Template-Matching
Collecting Multi-Template-Matching
  Using cached Multi_Template_Matching-1.5.3-py3-none-any.whl (22 kB)
Collecting scikit-image
  Using cached scikit_image-0.17.1-cp38-cp38-win32.whl (10.6 MB)
Requirement already satisfied: numpy in c:\users\stuart\pycharmprojects\bot_tutorial1\venv\lib\site-packages (from Multi-Template-Matching) (1.18.4)
ERROR: Could not find a version that satisfies the requirement opencv-python-headless==4.1.0.25 (from Multi-Template-Matching) (from versions: 3.4.8.29, 3.4.9.31, 3.4.9.33, 4.1.2.30, 4.2.0.32, 4.2.0.34)
ERROR: No matching distribution found for opencv-python-headless==4.1.0.25 (from Multi-Template-Matching)

Use of masks possible?

If we use method = TM_CCORR_NORMED, are we able to use a mask (as one can with OpenCV's matchTemplate)?

Or are there any other ways to search for something other than a rectangle? For example:

r

rmask

Typo?

Hi. Is it possible this is a typo?

`- sortAscending : use True when low score means better prediction (Difference-based score), True otherwise (Correlation score)`

(Should it say "False otherwise"?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.