Template matching

I was wondering if there is a way in KNIME to preform template matching, similar to this plugin for ImageJ: https://sites.google.com/site/qingzongtseng/template-matching-ij-plugin

I found the Compare Segments node, so I thought I'd give that a try. After finding out that it only takes binary images I used Local Thresholding after the image reader to make the images binary.

Here is my workflow:

And here is what I believe to be the output:

The top image is my template, and the bottom image is where I want to find the template, and preferibly in the future extract that part of the image, to do further processing with. Any help would be appreciated.

Edit: For some reason the pictures do not show up in my post.

Workflow: http://prntscr.com/96cvsm

Output: http://prntscr.com/96cwdf

I don't know if it helps for a workaround, but the feature is white, and the background is black, always. So perhaps some algorithm that finds the borders of this could also be used?

Hi Luuklag

If you could provide me with some more information I am happy to help you setting up a workflow which matches your template.

It helps a lot if the background is always black! Good to know.

Some other important questions are:

Is it always the same template?

How does the size of the template change over all other images?

 

If you can upload some example images I can set up a workflow.

 

Cheers,

Tim-Oliver

Currently I have 1 template, but in future it might be a bit more, but definetly limited to 5. Most likely 2 or 3.

Currently the size of the template as being an actual object is fixed, however not always the size in pixels is the same. In the future however I am thinking of using a fixed set-up for taking pictures, so that in theory the size in pixels should also be the same. However a way of computing that is based not on pixels but on the ratio between milimeters and pixels is also fine, as I know the size of the template.

Template:

Image

 

The image is a cut out of a bigger image, as the rest of the image could contain data I am not at liberty to share.

Thanks a lot for your hellp.

I should add that the reason I want to extract the labels is that I want to do OCR on them. As a lot of times they contain text (printed). I already tested doing OCR in KNIME and that works pretty well, as long as the image does not contain to many unnecesary elements. Therefore the desire to identify the label.

A fixed setup for taking all the pictures would help a lot!

I created a small workflow as a starting point. I just segment all the white stuff and then filter all small labels. Because the label is the only bright thing on your image this works good. If you have other images with some other bright parts which are not actual labels we probably have to improve this segmentation.

I also added some fake text to the label :)

Thanks a lot. This works like a charm :)