Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with looking for multiple templates - NI VISION

Hi there, I have an urgent need to solve my problem with the NI vision assistant express VI.

 

Imagine the following scenario:

 

I have to inspect a picture taken by a camera. The picture has an image of the Unit Under Test. We have absolutely no information about what kind of unit we are testing at this point, so what we have to do is to search for a grapichal pattern on the image. This can be done by creating a template and check if the template exists on the image. Based on this we will know what is the type of the unit, and we can go from there. Ohh, this is not too bad so far, right?

 

Wrong! There are approximately 100 different type of units. I used the Vision assistant express VI to create a simple algorithm which checks for a template on the image. I exposed the "Template file path" input, created an array of template paths and I thought I am ready to rock! BUT the express VI only ables to check the first template in the array!

 

I have tried lots of magic things to solve this, but finally I have checked the source of the express VI by using the "open front panel" option. I have found what you can see attached: so the "template file path" input ultimately goes to a case structure, which is driven by a "First call?" thingy. Obviously when the code iterates thru the paths it will call the TRUE state of the case structure only once. From then it gets the file path from the function global variable which is equal to the first element of my array of paths.

 

I need to use that array or else I should create 100 INDIVIDUAL EXPRESS VIs! If I replace the "First call?" to a boolean TRUE the VI works as expected. However in this case its not an express VI anymore and above this I have no clue if it will cause a memory issue or any other problems.

 

I have found a topic like this at the ni.com:

http://forums.ni.com/ni/board/message?board.id=200&message.id=12186&requireLogin=False

 

but it is very hard to accept the answer. So if I have 1000 templates what should I do? Create 1000 VIs?


I am positive (or lets say very optimistic) there is an easy solution for this. Please let me know, because I am in rush to solve this and present the solution!

 

thanks!

 

ps.: I have attached a zip file which shows the problem in a simplyfied way!

Message Edited by 1984 on 02-21-2010 04:32 PM
Download All
0 Kudos
Message 1 of 9
(4,390 Views)

From another perspective,

 

Is it a must that you should use a pattern matching for this? Do you have contrastingly varying characteristics that you can segregate using threshold and particle analysis. Can a filtering operation be done on the image to enhance it and do a threshold on that? Do you know there are lot of other features like object area, hole area, X-position through which you can distinguish objects?

0 Kudos
Message 2 of 9
(4,377 Views)

Thanks for your answer!

 

Yes, it is a must! I have simplyfied the task a bit in my post above. 

Even if there be one, the question I made is still legit. It is crazy that there is no way to check different templates with the express vi.

 

 

0 Kudos
Message 3 of 9
(4,370 Views)

Learn how to program without using Express VIs.  It is fairly simple in LabVIEW to read 100 template images, then loop through each one and search for it in the current image.  It will take a little while, depending on the size of your templates, but that is the fastest and easiest way to do it.

 

If you are able to use thresholding to convert it to a binary image, there are much faster methods of identifying your part.  I once created a system that measured several properties of the binary object (area, Mxx, Myy, etc.) and stored them in a table.  When comparing to a new image, it searched through the list for attributes that closely matched the new image.  If more than one template matched the new image, I used a more advanced comparison to narrow it down to one image.  This method only took one or two seconds max, probably less.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 9
(4,358 Views)

Hey Bruce,

 

thanks for your response. I will have no problem to create the same functionality with standard VIs, however I found the vision assistant express VI a fast and comfortable way to do it. I still think this is a bug and need to be solved simply because I can not see any justified reason for this wierd limitation.If it is a bug, then it need to be fixed, if not then I'd like to understand the purpose of this limitation. (maybe there is, I just can not see)

 

thx!

0 Kudos
Message 5 of 9
(4,354 Views)

Hi Istvan,

 

I will document a CAR for this issue, because I agree with you, that this functionality is not the best one. It will depend on our R&D, if they accept it as a bug.

 

Still you should look at the express vis as the easy to use top level vis and if you need some more functionality, that is not implemented, you should use lower level vis. 

 

With Regards,

 

Jiri Keprt

NIE Czech Republic

CLA, CTA

0 Kudos
Message 6 of 9
(4,309 Views)

CAR #210269

 

Jiri 

CLA, CTA

0 Kudos
Message 7 of 9
(4,303 Views)

Hey Jiri,

 

thanks for the CAR. I'd like to recommend a possible solution which is attached as a GIF. (no worries about the VI with a questionmark, I have Vision 8.6 and the original expr. VI is written in Vision 2009).

 

It is a different topic, but I miss another functionality from the Vision express and it is this: if I want to do an edge detection and I use the "straight edge (rake)" function I will get only the X1,Y1 and X2,Y2 coordinates of the edge. Most of the cases it is enough, but in many cases it would be very useful to get all the in between points of the edge as well. I assume the edge detection uses some kind of interpolation to determine the X1,Y1 and X2, Y2 of the edge, so it hides informations from the user but not giving all the points. (imagine a zig-zagging line: the straight edge will say "Hey dude, I have found a straight edge, here are the two ends of the line (X1,Y1;X2,Y2)", but actually by looking at all the points the edge is not straight but zigzagging)

 

Most likely this could be a very small modification in the express VI.

 

I know this is a different problem but plz take it under consideration!

 

thanks again for your efforts! Please keep me in the loop either by mail, or here at the discussion forum!

Istvan

 

Message Edited by 1984 on 02-25-2010 01:33 PM
0 Kudos
Message 8 of 9
(4,299 Views)

Hi Istvan,

 

for functionality, that is missing, you can fill the product suggestion on this link:

 

http://digital.ni.com/applications/psc.nsf/default?OpenForm

 

To the CAR. If you will need the update in the future, please contact our technical support (techsupport@ni.com) with CAR number (210269).

 

Regards,

 

Jiri 

CLA, CTA

0 Kudos
Message 9 of 9
(4,280 Views)