Skip to content

Template match methods: Accept matrix #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
strarsis opened this issue Jun 22, 2016 · 3 comments
Closed

Template match methods: Accept matrix #420

strarsis opened this issue Jun 22, 2016 · 3 comments

Comments

@strarsis
Copy link

strarsis commented Jun 22, 2016

Sometimes a template image has to be matched multiple times.
The current implementations of the template matching methods expect a file path.

Passing a matrix (e.g. from readImage(...)) as argument will not work and
results in an (unrelated) assertion failure.

Because the file data could actually come from many different places and through different ways,
it would make more sense to remove the path loading feature from the template matching methods
and rather let them exclusively accept a matrix instead.

@strarsis strarsis changed the title Template match methods: Accept buffer Template match methods: Accept matrix Jun 22, 2016
@evilcat-x
Copy link
Contributor

+1 for this.
I haven't write any c++ for years, and might look in to write some when I pick it backup.
I think the matchTemplate should be able to accept a buffer or a matrix.
Having a method that can only read from file system really defect all the purpose by using a C++ library.
In my case, I am trying to waiting for a image to show up on a certain website. The only way to do it now is to save the 'template' as a png on the filesystem to match. It would be much better to save it in the memory and use when the function get called.

Also a big downside for not able to accept matrix or a buffer is that we cannot first process the image then matchTemplate it. If I want to convert to grayscale or do canny edge then matchtemplate to reduce the possibility of false positive, right now we need to first write to a file then passing it to the c++ library

@strarsis
Copy link
Author

strarsis commented Jul 25, 2016

@Evilcat325: This may be of course only a workaround -
but you could try using a ramdisk mount for the temporary saving/loading image part.

@evilcat-x
Copy link
Contributor

evilcat-x commented Jul 25, 2016

@strarsis I just submit a pull request with unit test, hope it get merged~
I also create a temp npm for short term usage https://www.npmjs.com/package/opencv-temp-fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants