Saving Pattern matching information to an array

I am using imaqLearnPattern function to create a template image. According the IMAQ documentation, the pattern matching information is "appended" to the image. But when I try to call the imaqImageToArray function on this template image, it does not give me any pattern matching information. Is there any way, that I can save the template data into an array? I do not want to use the imaqWriteVisionFile function because I want the data in an array format and not saved in a file.
Thanks.

Normally you cannot save this information without this function. This information saved in *.png file. This format have a possibilities for saving "user data", and this fact used by IMAQ Vision. Theoretically you can extract this information from *.png into array (format of png is a well known format), but what can you do with this information afterwards? You cannot load this information separately without IMAQ Read Image and Vision Info.vi, because (pretty sure) this function allocated memory for Vision Info before loading, but you not able to do this. You can make this only if you know internal representation of IMAQ image in memory. How organized common parameters, such as width, height, pixel pointer, resolution, linewidth - not very complicated (IMAQ Image -
a cluster of string and pointer to appropriate structure), but where placed vision info - not very easy.
Better, fastest and easyest way - to use IMAQ Write Image and Vision Info.vi.
with best regards

Similar Messages

  • Pattern Matching and Vision Builder 6.0

    Hi,
    When I select a ROI from an image to generate a pattern matching, Builder
    saves it as a PNG file.
    If I open this pattern in other application (Paint Shop Pro 7) to modified
    it and save as a PNG file, after I can't open this file as a pattern into
    Builder, because it is considered as a not valid PNG file.
    I have tested this case in LabView 6.i and this problem doesn't appear.
    Any solution? Thanks.

    When the template is first saved in Vision Builder, pattern matching information is stored in the header of the PNG file. This information lets LabVIEW and Vision Builder know how the template was learned. Paint Shop Pro does not keep this information in the file whenever it is saved so Vision Builder will not recognize it as a valid pattern matching template.
    Jack Arnold
    Application Engineer
    National Instruments

  • Get information from an array saved into a text file

    I am trying to get information from an array saved as a text file to extract the information to build an string. This string will go out from the serial port to a device which will listen this message and it will answer the question. All the information sended sequencially it has to be obtained from that array. Every row contain one instruction and this has to be sended one after one.
    Could you tell me if is possible to make this driver? And if you have a similar driver, Where can I get it from?

    The VIs that I would suggest using are found in the String Function Pallet:
    Spreadsheet String To Array
    Array To Spreadsheet String
    The delimiter should be the termination character. These VIs will adapt to a string array.
    For the Spreadsheet String To Array wire an empty string array and use %s as the format. The delimiter should be the termination character of the text file, most likely a end of line (\r\n).
    For the Array To Spreadsheet String the delimiter should be the termination required for your serial device.
    Using a combination of these two VIs should provide you the functions required to make the driver.

  • 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

  • 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

  • How do I set multiple pattern matching Vi's and make overlappin​g pattern matches to count as one?

    Hello! I'm a student and I'm currently making a project using pattern matching.
    My patterns are from chick foot/feet.
    I'm  created multiple pattern matching VI's to detect all the feet because I find it difficult/impossible to match all the feet with a single pattern/template.
    However, when using multiple pattern matching VI's some pattern matches detect the same foot, hence overlapping.
    So how can I make the overlaping pattern matches to be counted as one?
    Thank you in advance

    Thank you for replying Sir Zwired1.
    I'm still a newbie in using LabVIEW so pardon me if I can't understand fully
    The objective of my project is to detect all the feet through pattern matching and count the pattern matches made.
    "Keep a 2D array of counts, initialized to zero and the same size as your array of possible locations, and increment the value every time you get a match. If multiple pattern matching attempts result in a match a given location in your count array might be "3" but all you care about is if the number is greater than zero."
    I'm sorry, but how do you do this? BTW, I'm using vision assistant.

  • How can I read a template and differentiate if it is a pattern matching template or a geometric matching template?

    Hey all,
    I would like to know how can I read a template´s information to know if it is a pattern macthing or a geometric matching template? 
    In my code, users provide templates and the algorithm must match them using pattern matching or geometric matching depending on the template.
    At the moment I am doing it by including a P or a G in the name of the file, but I would like to avoid this and read the information from the file.
    Any ideas?
    Thanks in advance,
    Esteban
    Solved!
    Go to Solution.

    Hey Esteban,
    you can use the VI "IMAQ Is Vision Info Present 2 VI" to reice the information:
    IMAQ Is Vision Info Present 2 VI - NI Vision 2011 for LabVIEW Help - National Instruments
    http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_is_vision_info_present_2/
    Take a look at the attached VI
    Stephan
    Attachments:
    Determine Pattern type.zip ‏13 KB

  • Who knows how to output some text once labview detects something I want using pattern matching(V​ision assistant)​?

    who knows how to output some text once labview detects something I want using pattern matching(Vision assistant)?
    The text is something like"Yes, this is a coin"
    Thanks!

    I attached a SubVI which I used to place an overlay next to a Pattern, found by a Pattern Match before:
    As you can see, you simply pass the image reference and the Array of Matches to the VI along with the String you want to have as an overlay next to the Match.
    I also modified your VI a bit, but didn't test it. I created an Array of clusters, each elment containing the template path along with the respective text.
    Please note that this is just a hint!
    Christian
    Attachments:
    suggestion.vi ‏146 KB
    Overlay_Txt.vi ‏24 KB

  • Pattern matching in String

    Hi,
    I want to do pattern matching using String. Here is my requirement.
    String file_name = (String)hash.get("DOCNAME"));
    file_name = file_name.replace("'","285745@");
    So, whereever I have '(apostrophe) I will replace it with pattern "285745@" and then at another jsp where I get this request parameter I do reverse as follows:
    String docname = (String)request.getParameter("doc_name").replace("285745@","'");
    Now I know replace function is not going to do this. It is just a indicative, for you to know what I want to achieve. which other java function / method i can implement to get the desired result.
    thanks,
    pp

    String file_name = (String)hash.get("DOCNAME"));
    file_name = file_name.replace("'","285745@");The problem here is that String.replace() operates only on char arguments, you cannot replace entire substrings with it.
    The String.replaceAll() method, on the other hand, operates on regular expressions. In many common cases (those in which the substring you want to find contains no characters with special meaning to the regular expression processor) you can use it exactly as you would String.replace() except that it operates on substrings.
    But regular expressions are much more powerful than that. The javadoc for the "Pattern" class has some information on how to use them. There is also a tutorial at http://java.sun.com/docs/books/tutorial/extra/regex/intro.html which you might find helpful.
    In the 1.4 edition of Java there is no longer any need to screw around with while loops and StringBuffers. Nearly any text processing operation can be done with regular expressions.

  • 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

  • Color pattern match in consumer producer architecture

    The way I currently have my code is as follows:
    If the number of matches in a color pattern match is greater than 0, it sends the information to the consumer loop.
    If it is not greater than 0, it doesn't send anything.
    What I was wondering is, if it finds a match the first time and it sends the information to the consumer loop, will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match? If the number of matches in the color pattern match will be greater than 0 after the first match, and it will still be greater than 0, even though it doesn't find a match in the following scenarios, how can I make the number of matches in the color pattern match return to 0?

    Fernan1988 wrote:
    ... will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match?...
    it's hard to say unless you can post your code....have you tried probing tool,retain wire value,highlight execution,single stepping into and out, breakpoints?

  • Latin 1 supplement for Pattern matching

    Hi All,
    I am trying to pattern match a string with the following pattern:
    "\\p{InLatin1Supplement}+"(want to allow only characters in Latin 1 Supplement charset)
    However I get java.util.regex.PatternSyntaxException: Unknown character family {Latin1Supplement}Please suggest what should be the proper string for the pattern.
    Thank you !!

    Hm, have your checked Blocks-3.txt, as it says in the javadocs?
    "Unicode blocks and categories are written with the \p and \P constructs as in Perl. \p{prop} matches if the input has the property prop, while \P{prop} does not match if the input has that property. Blocks are specified with the prefix In, as in InMongolian. Categories may be specified with the optional prefix Is: Both \p{L} and \p{IsL} denote the category of Unicode letters. Blocks and categories can be used both inside and outside of a character class.
    The supported blocks and categories are those of The Unicode Standard, Version 3.0. The block names are those defined in Chapter 14 and in the file Blocks-3.txt of the Unicode Character Database except that the spaces are removed; "Basic Latin", for example, becomes "BasicLatin". The category names are those defined in table 4-5 of the Standard (p. 88), both normative and informative."
    Other than that, I don't know, sorry.

  • Help for image pattern matching

    Hello Everyone
    I am working for my last year project. In my project I will work on the image processing to find a moving object. I will work by JMF. I have finished to grab a frame from the webcam video clips. Now I need a algorithm to find a Image pattern from the grabed image. But I donot know which algorithm is fine for image pattern matching as well as how can I implement in java. Is anyone know please help me very urgently.
    Thank you
    Md. Mainul Hasan

    If you would like to take a look at http://www.exactfutures.com/index01.htm and http://www.exactfutures.com/index02.htm and http://www.codeproject.com/useritems/activity.asp then these pages and links may well be useful to you. It may not be exactly what you are looking for, but it does point to some examples with source for video analytics, and at the very least they illustrate how to capture & handle the data including a fast movement detection algorithm. If you want to find a specific shape then search the internet for information on chamfer distance transforms - one can use JMF or extend these simple examples to apply those techniques.

  • Pattern matching using Regular expression

    Hi,
    I am working on pattern matching using regular expression. I the table, I have 2 columns A and B
    A has value 'A499BPAU4A32A386KBCZ4C13C41D20E'
    B has value like '*CZ4*M11*7NQ+RDR+RSM-R9A-R9B'
    the requirement is that I have to match the columns of B in A. If there is a value with * sign, this must be present in A like 'CZ4' should exit in string A.
    The issue I am facing is that there are 2 values with * sign. The code works fine for first match (CZ4) but it does not look further as M11 does not exist in A.
    I used the condition
    AND instr(A,substr(REGEXP_SUBSTR(B, '*[^*]{3}'),2) ,1)=0
    First of all, is this possible to match multiple patterns in one condition?
    If yes, please suggest.
    Thanks

    user2544469 wrote:
    Thanks a lot Frank. This query worked wonderful for the test data I have provided however I have some concerns:
    - query doesnot include the column BOOK which is a mandatory check.Sorry, that was my mistake. It was a very easy mistake to make, since you posted sample data where it didn't matter. Instead of doing a cross-join between vn and got_must_have_cnt, do an inner join, using book. That means book will have to be in got_must_have_cnt, and all the sub-queries from which it descends. Look for comments that say "March 22".
    If you want to treat '+' in test_cat.codes as '*', then the simplest thing is probably just to use REPLACE, so that when the table has '+', you use '*' instead.
    WITH     got_token_cnt     AS
         SELECT     cat
         ,     book                                        -- Added March 22
         ,     REPLACE (codes, '+', '*') AS codes                    -- If desired.  Changed March 22
         ,     LENGTH (codes) - LENGTH ( TRANSLATE ( codes
                                                       , 'x*+-'
                                      , 'x'
                             ) AS token_cnt
         FROM    test_cat
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     (  SELECT  MAX (token_cnt)     AS max_token_cnt
                 FROM        got_token_cnt
         CONNECT BY     LEVEL     <= max_token_cnt
    ,     got_tokens     AS
         SELECT     t.cat
         ,     t.book                                        -- Added March 22
         ,     REGEXP_SUBSTR ( t.codes
                         , '[*+-]'
                         , 1
                         , c.n
                         )          AS token_type
         ,     SUBSTR ( REGEXP_SUBSTR ( t.codes
                                       , '[*+-][^*+-]*'
                               , 1
                               , c.n
                   , 2
                   )          AS token
         FROM     got_token_cnt     t
         JOIN     cntr          c  ON     c.n     <= t.token_cnt
    ,     got_must_have_cnt     AS
         SELECT       cat, book                                   -- Changed March 22
         ,       COUNT (CASE WHEN token_type = '*' THEN 1 END) AS must_have_cnt
         FROM       got_tokens
         GROUP BY  cat, book                                   -- Changed March 22
    SELECT       mh.cat
    ,       vn.vn_no
    FROM       got_must_have_cnt     mh
    JOIN                    vn  ON  mh.book     = vn.book               -- Changed March 22
    LEFT OUTER JOIN      got_tokens     gt  ON     mh.cat                  = gt.cat
                                     AND INSTR (vn.codes, gt.token) > 1
    GROUP BY  mh.cat
    ,            mh.must_have_cnt
    ,            vn.vn_no
    HAVING       COUNT (CASE WHEN gt.token_type = '*' THEN 1 END)     = mh.must_have_cnt
    AND       COUNT (CASE WHEN gt.token_type = '-' THEN 1 END)     = 0
    ORDER BY  mh.cat
    - query is very slow with 60000 records in vn table. Cost is somewhere around 36000.See these threads:
    When your query takes too long ...
    HOW TO: Post a SQL statement tuning request - template posting
    Relational databases were designed to have (at most) one piece of information in each column. If you decide to have multiple items in the same column (as you have a variable number of tokens in the codes column), don't be surprised if that makes things slower and more complicated. Most of the query I posted, and perhaps most of the time needed, is jsut to normalize the data. If you stored the data in a narmalized form, perhaps something like got_tokens, then you wouldn't need the first 3 sub-queries that I posted.
    Edited by: Frank Kulash on Mar 22, 2011 12:04 PM

  • SLOW pattern matching in VB, FAST in VisionBuil​der?????

    I've built several vision aquisition and analysis apps with VB and CWIMAQ. Now, I'd like to do a pattern matching application, however, I can't seem to get the same functionality and speed with the VB component as I can using VisionBuilder! Attached is a grayscale image of a microtiterplate, and a "pattern" of a well or "hole". Using pattern matching in visionbuilder there are about 96 matches, which is perfect, dang near a match for every well. However, if I try to reverse engineer the VB "FeatureFind" example and use the attached picture and pattern, the "Correlation" takes a VERY long time (14 seconds for VB featurefind app, instant for VisionBuilder), and it doesn't even match!
    Even though I can't use
    visionbuilder in my final application, it works almost perfectly when I use the attached image and pattern while setting the minimum score to 50. I wish I could implement the same thing in VB, that is, if NatInst could tell me the CWIMAQ components function calls used to implement it :-0)
    Any Ideas? Thanks
    Attachments:
    bw.tif ‏301 KB
    test_patt.png ‏57 KB

    I am not familiar with the VB commands you want to use since I use LabVIEW. However, I think you might be using the wrong function. It sounds like the example you tried to modify uses correlation, which is different from pattern matching. As you have seen, pattern matching is much faster and gives better results.
    I would assume that the manual for CWIMAQ would give you the information you need.
    Bruce
    Bruce Ammons
    Ammons Engineering

Maybe you are looking for