Added template matching

Post Reply
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Added template matching

Post by thereza »

I don't want to use the standard round fiducials so I've added support for template matching so you can detect arbitrary objects. This can be used in a number of places as well. The code requires OpenCV via EmguCV which only adds a few .dlls to the application.

I'm still not sure how to resubmit my changes back and git seems overly complicated.

In this test, I am trying to match a parasitically shaped pad. The code will look for the shape and a 90 rotated version of it. Here are preliminary resulsts

Image

The code should also work fine in color, but I've not tested that yet.

Reza
mrandt
Posts: 407
Joined: Mon Apr 27, 2015 10:56 am
Location: Stuttgart, Germany

Re: Added template matching

Post by mrandt »

Hi Reza,

if you can code stuff like this, you can definetely master git...

Have you seen my hints in reply to your other post?

http://liteplacer.com/phpBB/viewtopic.php?f=10&t=57

If it still does not work, I am happy to help.
thereza
Posts: 138
Joined: Fri Feb 13, 2015 11:49 pm

Re: Added template matching

Post by thereza »

I guess I'm an old school SVN kind of guy. This distributed repositories notion just seems overkill. I'll check out your post though - didn't notice it before - thanks for pointing it out. So this is what I would like to do, let me know if it's possible.

- create a branch with my version of the code
- allow me to pull in changes from the main tree into mine
- allow the author to pull changes he likes from my code into his

how do I do that?

I've made a bunch of changes to the code all over to accommodate the feature addition. It seems to work fine now, which means I can go onto the next step of trying to use the device to actually place components.

The basic notion is that after you apply your filters, use snip.exe (comes with windows) to capture an image of the fiducial you are interested in, clean it up a bit, and then specify it using the ... button. The threshold is how strong of match is required (1 = max). The Find Fiducials button will overlay the image with the found fiducials. Seems quite robust so far in my testing.

Image

The template matching I think can be reused for detecting shape/orientation of arbitrary parts - once trained.

I've never done any video processing before, and the creepy thing is that I kept seeing references to my grad school adviser who came up with some edge detection routines when he was doing his masters that's used everywhere. I think I suffered PTSD being his student from him and it brought back some unwanted feelings.
Lars
Posts: 8
Joined: Mon Feb 09, 2015 8:39 pm

Re: Added template matching

Post by Lars »

thereza, kudos to you. Never did any image recognition before and mastering this with ease.. I'm feeling so small with my Arduino-skills all of a sudden.
mrandt
Posts: 407
Joined: Mon Apr 27, 2015 10:56 am
Location: Stuttgart, Germany

Re: Added template matching

Post by mrandt »

thereza wrote:I guess I'm an old school SVN kind of guy. This distributed repositories notion just seems overkill. I'll check out your post though - didn't notice it before - thanks for pointing it out. So this is what I would like to do, let me know if it's possible.

- create a branch with my version of the code
- allow me to pull in changes from the main tree into mine
- allow the author to pull changes he likes from my code into his

how do I do that?
Sorry, only just read this. I think you already did most of what it takes ;-)

If you want to create a public copy of the code on GitHub, which is completely under your control, you create a fork. This bascially copies everything from the main repository into your fork - not just on client side but in GitHub.

Within your fork, you can still create branches - e.g. for different features or versions. Think of the branch as something local to a repository while a fork is a global clone or copy. If Juha deleted his repo, your fork would remain. If you deleted your repo, the branches would go away.

Using a fork and one or more branches will allow you to pull changes from Juha's tree into yours and vice versa. On the GitHub website, the changes can be nicely visualized in a tree view.

To work on files on your machine, you usually clonethe files (also called clone to desktop) and then you apply your changes. There is also checkout, but be carful as it overwrites local changes, similar to revert in SVN. I read your rant in the other post, maybe this is what happened? For files you did clone, git can then automatically track the changes and allow you to commit these later.

To commit files that have not been cloned or checked out before, you add these to git version control - this is just like import in SVN. Please note that the local changes are not visible to others until you push these to the remote (GitHub) repository.

Finally, a pull request is the task which asks others, e.g. Juha, to pull a subset of your changes into the original repository main trunk.

I hope this helps to clarify a few of the concepts.

If you are coming from CVS or SVN, I recommend the following tutorial:
http://git-scm.com/course/svn.html

While this uses commandline, the same applies to GUI client.

Good luck and have fun!
Spikee
Posts: 115
Joined: Wed Mar 04, 2015 9:49 am

Re: Added template matching

Post by Spikee »

I know this is an old post but still.
Had a bit of trouble with the default fiducial finder.

So... i just made a screenshot of the fiducial and used is as an template. Works great!
Image
Post Reply