Pattern matching program

Hello,
I am creating a program that does pattern matching on a video. I want the program to be able to open a template to be used for the pattern matching template and to allow the user to select a template from an image in Labview and then use this template as the pattern matching template. I have code that does all of this. The part that allows a user to select a template in Labview is a sample program that comes with Labview. I just do not know how to incorporate it. Thanks.
Solved!
Go to Solution.

Hi frog,
Here in attached vi, Ckeck it out your problem solved or not. If not, post the video file also. will help you..
Not to mention: Your vi is so big. You have to really optimize your vi.
Sasi.
Certified LabVIEW Associate Developer
If you can DREAM it, You can DO it - Walt Disney
Attachments:
Pattern Tracking 2.vi ‏135 KB

Similar Messages

  • How can I load pattern matching images into memory?

    I discovered this problem by accident when our network went down. I could not run my VI because the .png file used for pattern matching was on a network drive. My concern it the amount of time that is required to read a network file. Is there a way to load the file into memory when the VI is opened?

    Brian,
    Thank you for contacting National Instruments. For most pattern matching programs, the pattern file should only be read from file once and is then copy to a buffer on the local machine. If you examine your code, or an example program for pattern matching, you should see at least two IMAQ Create VI called somewhere near the front of your code. This VI basically creates a memory location and most likely will be called once for your pattern image and once for the image you are searching.
    Unless you are specifically calling a File Dialog VI where you are given a dialog box to open a file or have hard coded the file path so that it is read each iteration of your code, then your pattern file should only need to be called at the beginning of your application, th
    us causing only one file read over the network for that image. Therefore your program most likely already loads the image in memory once it is read and should not be accessing the network constantly.
    Again, I would recommend taking a look at your code to make sure you are not causing a file access every time and then you should be ready to go. Just in case you do have the network go down, I would recommend keeping a copy of the image locally and, if you are feeling ambitious, you can programmatically have your program read the file locally if the network file returns an error.
    Good luck with your application and let us know if we can be of any further assistance.
    Regards,
    Michael
    Applications Engineer
    National Instruments

  • Iterative pattern matching

    Hi, I need to create a pattern matching program. I have successfully created one that matches a template image to a full video. Now, I need a program that updates the template image with each frame. So I would create the template on frame 1. Then on frame 2, when the program finds a spot that matches the template, it saves this image as the new template to compare to the next frame. This would continue for the full video. Does anyone have a program that does this? Or any idea where to start? I am using Labview 2010. Thank you!

    Here is my current program!
    Attachments:
    20120417 Tracking.vi ‏588 KB

  • Is there a way to turn the pattern matching example in Labview to instead of loading a rectangle around what you want the template to be you can use an image display , I've be trying and can get no where with it

    What I want to do is , have two images on image displays and the pass them through the same setup as the pattern matching example to get the number of matches , I have attached what I have done and also given the pattern matching example program as well.
    Hope to get answers back soon,
                                     Thanks Alan
    Attachments:
    screenshot.docx ‏48 KB
    Pattern Matching Example.vi ‏100 KB

    Hi there!
    The example used can be adapted for comparing two images, however the algorithm and coding for finding the differences is more specific to your actual problem. In terms of the loading and displaying of the images, this can be done in the same way.
    Once you have some sort of algorithm, then you can automate the learning and matching by simply wiring them in order. (in the example, these are put in case structures as they are waiting on response from the front panel)
    I hope that this helps,
    Liam A.
    National Instruments
    Applications Engineer

  • Pattern matching problme - not getting desired result.

    Hi,
    According my program , If 'san' is in 'sangeetha', then it should display "hello".
    but I am getting only 'hi'
    Why ? any idea?
    <%@ page import="java.util.regex.Pattern"%>
    <%
    if(Pattern.matches("san", "sangeetha"))
    out.println("hello");
    else
    out.println("hi");
    %>
    Result : Hi

    sangee wrote:
    Hi,
    According my program , If 'san' is in 'sangeetha', then it should display "hello".No, that isn't what your patten say. You should read about regular expressions and learn how to use them, or switch to String.indexOf or contains.
    Kaj

  • Is it pattern matching the best way to check presence and orientatio​n of components on a pcb board?

    Hi, like i ask on the title i need some hint about this. I need to program a simple AOI machine that must inspect a pcb board and find if all the components are correctly placed and oriented. I though to use the pattern matching with a good template of the object to inspect. Can it work?
    All kinds of tips that may come to your mind please tell me, because this is the first time i try a task like this. I already have some experience in image manipulation but not in AOI machines.
    Francesco.

    Hi Francesco,
    you can find some useful information here, here and here.
    I hope this will help!
    Bye,
    Licia

  • How to implement pattern matching in RFC input paramenter?

    Dear Friend.......
    I have a requirment for implement a pattern match for name field of vendor in one of RFC.........
    For ex..........
    Name field:-  A* -> give all list of name  starting with a.
    how can we implement this?
    Any way............Suggest me
    Regards
    Ricky

    Hi,
    I am not using any ABAP program for calling this RFC,I am using Webdynpro for this one.
    so how it possible to implemnet same things at there.
    Regards
    ricky

  • USB SNAP + colour pattern matching ( IMAQ)

    I am new to LAbView and currently  I am working on colour pattern matching with USB snap. My problem is this program keep prompt me on the IMAQ Learn Colour Pattern. I need someone to help me solve that problem.
    Another question is 'Are colour pattern matching require us to save and load file before learn a template?'
    I am using LabView 7.1 and I would appreciate anyone who help me. Thanks
    Message Edited by Chee Hou on 09-16-2009 03:46 AM
    Attachments:
    Untitled.vi ‏189 KB

    Hello Chee Hou,
    Have you tried to run the example to do color pattern matching?
    From the example, you do need to have a template picture ready when you are using the colour pattern matching.
    You need to Learn Colour Pattern and then load the pattern to do color pattern matching.
    Hope this helps.
    James
    - Meadow -
    LabVIEW 7.0 - 2011, Vision, RT, FPGA
    TestStand 3.0 - 4.5

  • Pattern Matching problems

    Hi people,
    I'm having a slight problem with pattern matching. What I need to do is find if my pattern is a given string an return the end index.
    Here's my string:
    <TD>Some text</TD>
    I need to find everything between the 2 anchor tags. (In this case "Some text"). The query string parameters are the only thing that can change.
    Here's what I've tried:
    Pattern pattern = Pattern.compile("<a href=\"/cgi-bin/dir/program.cgi?PARAM1=[0-9]&PARAM2=[0-9]*\"onmouseover=\"window.status='';return true;\">");
    Matcher matcher = pattern.matcher(myString);
    if ( matcher.find() ) {
       System.out.println(matcher.end());
       System.out.println(myString.substring(matcher.end(), myString.toLowerCase().indexOf("</a>",matcher.end())));               
    }Of course I've tried a lot of other things. I've also googled to try to find some examples but to no avail.
    Thanks for any help.

    Just change your Patterne. It will work. The '?' character is being considered as a pattern matching character, while you want it as it is. Use \\ before '?' character.
    Pattern pattern = Pattern.compile("<a href=\"/cgi-bin/dir/program.cgi\\?PARAM1=[0-9]&PARAM2=[0-9]*\"onmouseover=\"window.status='';return true;\">");
    Hope it helps.

  • Pattern Matching/Encoding

    I have the following code working to identify characters in a string that are not in the ASCII character set. Now I want to do the same thing and compare the string to the Cp1252 character set but regex doesn't seem to have that functionality.
    I tried Pattern pattern = Pattern.compile("\\P{Cp1252}");
    Can anyone point me in the right direction?
         Pattern pattern = Pattern.compile("\\P{ASCII}");
         while ((test=r.readLine())!=null) {
                Matcher matcher = pattern.matcher(test);
                boolean found = false;
                while (matcher.find()) {
                    w.write(i + delim + matcher.group() + delim +  (matcher.start() + 1) + delim + (matcher.end() + 1) + delim + test);
                    w.write('\r');
                    w.write('\n');
                    found = true;
                }

    As a rule, regexes don't match characters according to whether they're covered by a given encoding. (The "ASCII" in \p{ASCII} isn't so much a reference to the ASCII charset as it is an acknowledgement that other charsets exist, in the same sense that nobody ever used the phrase "analog wristwatch" until digital watches came out.) However, Java's Pattern class does have a pre-defined character class, \p{L1}, that seems to correspond to Latin1, or ISO-8859-1. Cp1252 is a superset of Latin1 which adds several characters in the 128-159 range that Latin1 doesn't use.
    Matching those characters in a Java program is tricky because (1) if you type them in directly and then save the source file as Latin1 (the default encoding on some systems), they'll all turn to garbage; and (2) you can't use their Cp1252 encodings, as in [0xF0-0x9F], because Java char's are encoded as UTF-16. The only safe way to match them (or not match them, in your case) is to type in their Unicode escapes:
      "[^\\p{L1}\u0152\u0153\u0160\u0161\u0178\u017D\u017E\u0192" +
      "\u02C6\u02DC\u2013\u2014\u2018-\u201A\u201C-\u201E" +
      "\u2020-\u2022\u2026\u2030\u2039\u203A\u20AC\u2122]"

  • Pattern matching for LCD function test

    Hello,
    I am writing a VI that is taking a single picture from a camera and then compares it with a template extracted before that.
    The camera is looking at LCD display and and the purpose of the matching is to find whether there is a dead pixel or sth wrong at the display. The problem is that the comparison doesn't work as expected.
    I will illustrate this with just one examples with picture attached:
    - At step 1. the template is created. (you can see RUN 2 at the top left corner at the display) 
    - At step 2. pattern matching is performed with the same mode of the LCD but a little bit tilted(score - 972 achieved)
    - At step 3. the mode is changed (you can see RUN 3 at the top left corner at the display, everything else is the same) - but however a bigger score of 974 is achieved
    Any explanation of this and some suggestions that can improve my program !?
    Thanks a lot
    Iliya G. 
    Attachments:
    1step.JPG ‏43 KB
    2step.JPG ‏42 KB
    3step.JPG ‏38 KB

    Hi David,
    I went through this OCR examples that you mentioned but in fact I find them very annoying because in many cases the output string depends on how you draw your ROI. Please, find an example below and could you please tell me if i am doing sth wrong, but in fact i don't think so.
    When I try to read the characters separetely, everythings goes ok - it finds r,u,n and 1.
    But when I make the ROI bigger in order to contain all the characters, the output is the one at the picture. Any ideas?
    Thanks,
    Iliya 
    Attachments:
    1.JPG ‏21 KB

  • A regular expressin problem: String.matches & the pair of Pattern & Matcher

    I observe this problem when working on pattern match for Z5Z-5Z5, Z5Z 5Z5 or Z5Z5Z5.
    When I use the match method of the String class, the correct pattern will yield true with
    !str.matches("^[A-Za-z]\\d[A-Za-z]\\s?|-?\\d[A-Za-z]\\d$").
    When I use the pair classes of regex:
    Pattern p = Pattern.compile("^[A-Za-z]\\d[A-Za-z]\\s?|-?\\d[A-Za-z]\\d$");
    Matcher m = p.matcher(str);
    a string of "v7u h4e" (two blank spaces in between) can pass the !m.find().
    Have anyone else experienced the same situation?
    Do I use them right, or bugs?
    Thanks for your input.
    v.

    This is why I wish regex references would list the
    operator precedence. What do you mean? My regex reference does show that right under the section called "Operators" in the second chapter.
    Maybe you need to update your references and buy "Programming Perl"? :)
    I think there are only three
    levels of precedence, but it needs to be crystal clear
    that | has the lowest precedence (even lower than
    putting two tokens together!) and often needs
    parentheses: "\w\d|\s\w" means "(\w\d)|(\s\w)", not
    "\w(\d|\s)\w".Actually for that particular operator it is pretty consistent. It is always very low. Even when I was introduced to the theory of regex's in school the precedence was lower than everything else.

  • How to use Labview to output the coordinates from Pattern Matching result

    I tried to add some labview commands into the vi program created by IMAQ Pattern Matching scrip to output the coordinates of a target point found in Pattern Matching because i need to do some calculations for the point coordinates and I don't want just to read the values from the IMAQ results on the monitor. Does anyone can help me? Thank you.
    Attachments:
    PatternMatching1.vi ‏84 KB

    I have posted replies to your other postings with your same question, and continue to recomend that you look at some of the LabVIEW tutorials.
    I modified the attched program such that it would index the arrays of match information returned and then unbundle the X and Y features of the match and add them to gether as an example of how to access the data programatically.
    I hope this helps.
    Regards,
    Amaury Rolin
    NI Applications Engineer
    Attachments:
    PatternMatching_mod.vi ‏88 KB

  • How do I do input pattern matching with the 6534?

    I am configuring the 6534 to have one 8 bit input port and one 8-bit output port. Both input and output are in continuous mode. The input port is scanning for a specific pattern, but doesn't need to save the data. When this specific pattern is received, the VB program must be notified so that it can perform some action. This will occur every 2 seconds, i.e. the input pattern will match every two seconds. How do I perform this continuous pattern match and how can I throw away the input data without overflowing the input buffer?

    It sounds like you want to do DAQ Event Messaging. With this mechanism, the driver actively notifies the user of a specific DAQ Event by either posting a message on a message queue or calling a callback function.
    There are several documents that describe how you can do this with Visual Basic. You can find some KnowledgeBase entries, and a really useful tutorial called "Using DAQ Event Messaging in Windows under Windows NT/95/3.1". You can find these by searching the http://www.ni.com/support pages for "daq event message", and then go on to choose Visual Basic, and Learning to use product features and functions.
    The feature that you are looking for is pattern matching, which is DAQ Event type 8 ? Digital Pattern Matched. When the document refers to the
    Config_DAQ_Event_Message, you can see the details of this function in the NI-DAQ Help file (Start menu >> Programs >> National Instruments >> NI-DAQ). As you will see in the tutorial, you use a different but analogous method. While you won't be using this particular function for Visual Basic, the description of those events may be helpful.
    Regards,
    Geneva L.
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Live video pattern match

    Hi,
    I have created a program from where you can look at a live video (contious aquisition within a loop) and from that, create a template which you then use pattern match on. The idea is to be able to track movements of the template (in my case components on a PCB) in the live video. Everything works just fine, however, when I try to change the template in the program (I have a button in the GUI where you can either create a new template or load a previously saved template), the program for some reason still uses the "old" template. I'm not succeeding to change the template used in the pattern match part of the vision assistant express vi while I'm running the program.
    If I stopp and restart the program I can load a new template however.
    I'm beginning to think it has something with the image aqusition and not disposing images correctly, to do but I could need some help.
    Is there an example out there that uses live video pattern match where you can load/create templates on the fly?
    Thanks!

    Thanks Sasi,
    I looked at the example but it not really what I looked for. In your example, the match is done on a previously recorded video file. What I would like to do is to do the matching on a live video.
    I've managed to do matchpattern the first time I load or create a searchpattern. But if I want to change the match pattern template while running the VI, it continues to use the old one...(I'm aware I have trouble explaing the problem...)
    The structure of my VI is as follows:
    while (not stopped or stop aquisition of images)
     1. Continously aquire images
     2. Do a search pattern task (a -no pattern match, b -use "old" pattern, c - create new pattern and d -load a previously saved pattern)
     3. Do a pattern match (use vision assistant to do a pattern match on the image aquired in step 1, with the template from step 2.
     4. Overlay the match (if found) to the image aquired from step 1.
     5. Calculate the radial movement between two following frames (the calibrated matches array from vision assistant in step 3.
     6. Save radial movement to file
    end
    It works, but I have to restart the VI before I can use a new template (otherwise it just keeps showing the first match)
    I guess it has something with how I aquire images, to do?
    Best regards,
    //Jonas

Maybe you are looking for